deleteChannel method
Delete a channel
Archives a channel. This will set the deleteAt
to the current timestamp in the database. Soft deleted channels may not be accessible in the user interface. They can be viewed and unarchived in the System Console > User Management > Channels based on your license. Direct and group message channels cannot be deleted. As of server version 5.28, optionally use the permanent=true
query parameter to permanently delete the channel for compliance reasons. To use this feature ServiceSettings.EnableAPIChannelDeletion
must be set to true
in the server's configuration. If you permanently delete a channel this action is not recoverable outside of a database backup. ##### Permissions delete_public_channel
permission if the channel is public, delete_private_channel
permission if the channel is private, or have manage_system
permission.
Parameters:
- String channelId (required): Channel GUID
Implementation
Future<MmStatusOK?> deleteChannel(
String channelId,
) async {
final response = await deleteChannelWithHttpInfo(
channelId,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'MmStatusOK',
) as MmStatusOK;
}
return null;
}