/* Missing: download download_zip upload */ struct Response { e: Option, o: Option } struct LoginResponse { otp_needed: bool, token: Option } struct Session { name: String, tfa_enabled: bool, admin: bool, sudo: bool } trait Auth { fn signup(username: String, password: String) -> Option; fn login(username: String, password: String, otp: Option) -> Response; fn send_recovery_key(username: String); fn reset_password(key: String, password: String) -> Option; fn change_password(token: String, old_pw: String, new_pw: String) -> Option; fn logout(token: String); fn logout_all(token: String) -> Option; fn tfa_setup_mail(token: String) -> Option; fn tfa_setup_totp(token: String) -> Response; fn tfa_complete(token: String, otp: String) -> Option; fn tfa_disable(token: String) -> Option; fn delete_user(token: String) -> Option; fn session_info(token: String) -> Response; } struct UserInfo { id: u64, name: String, tfa: bool, admin: bool, enabled: bool } trait Admin { fn list_users(token: String) -> Response<[UserInfo]>; fn delete_user(token: String, user: u64) -> Option; fn logout(token: String, user: u64) -> Option; fn disable_tfa(token: String, user: u64) -> Option; fn set_admin(token: String, user: u64, admin: bool) -> Option; fn set_enabled(token: String, user: u64, enabled: bool) -> Option; fn sudo(token: String, user: u64) -> Option; fn unsudo(token: String) -> Option; fn shutdown(token: String) -> Option; } struct Node { id: u64, name: String, file: bool, preview: bool, parent: Option, size: Option, children: Option<[Node]> } struct CreateNodeInfo { id: u64, exists: bool, file: bool } struct ZipInfo { done: bool, progress: u64, total: u64 } struct PathSegment { name: String, id: Option } trait FS { fn get_node(token: String, node: u64) -> Response; fn get_path(token: String, node: u64) -> Response<[PathSegment]>; fn get_nodes_size(token: String, nodes: [u64]) -> Response; fn create_node(token: String, file: bool, parent: u64, name: String) -> Response; fn move_nodes(token: String, nodes: [u64], parent: u64) -> Option; fn delete_nodes(token: String, nodes: [u64]) -> Iterator; //fn create_zip(token: String, nodes: [u64]) -> Response; //fn zip_progress(token: String, zip_id: u64) -> Response; fn download_preview(token: String, node: u64) -> Response; fn get_mime(token: String, node: u64) -> Response; }