Function wicrs_server::api::create_hub [−][src]
pub async fn create_hub<S: Into<String>>(owner_id: S, name: S) -> Result<ID>
Expand description
Creates a hub, returning the ID of the new hub if successful. Also adds a default channel named “chat” that all users have access to by default.
Arguments
owner_id
- ID of the user who should be marked as the owner/creator of the hub.name
- The name of the new hub.
Errors
This function may return an error for any of the reasons outlined in the following functions:
- The user’s data could not be saved for any of the reasons outlined in [
User::save
]. - The hub failed to save for any of the reasons outlined in
Hub::save
. - The given name failed to pass the checks for any of the reasons outlined in
check_name_validity
. - The default channel could not be created for any of the reaons outlined in
Hub::new_channel
.