Function wicrs_server::api::create_channel[][src]

pub async fn create_channel<S: Into<String> + Clone>(
    user_id: &str,
    hub_id: ID,
    name: S
) -> Result<ID>
Expand description

Creates a text channel in a hub. Returns the ID of the new channel if successful.

Arguments

  • user_id - ID of the user to check for permission to create the channel.
  • hub_id - ID of the hub in which the channel should be created.
  • name - Name for the new channel.

Errors

This function may return an error for any of the following reasons:

  • THe user is not in the hub.
  • The name failed to pass the checks for any of the reasons outlined in check_name_validity.
  • The hub could not be loaded for any of the reasons outlined by Hub::load.
  • The hub could not be saved for any of the reasons outlined by Hub::save.
  • The user does not have permission to create new channels.
  • The channel could not be created for any of the reasons outlined by Hub::new_channel.