updateChannelPrivacy method
Future<MmChannel?>
updateChannelPrivacy(
- String channelId,
- MmUpdateChannelPrivacyRequest mmUpdateChannelPrivacyRequest
Update channel's privacy
Updates channel's privacy allowing changing a channel from Public to Private and back. Minimum server version: 5.16 ##### Permissions manage_team
permission for the channels team on version < 5.28. convert_public_channel_to_private
permission for the channel if updating privacy to 'P' on version >= 5.28. convert_private_channel_to_public
permission for the channel if updating privacy to 'O' on version >= 5.28.
Parameters:
-
String channelId (required): Channel GUID
-
MmUpdateChannelPrivacyRequest mmUpdateChannelPrivacyRequest (required):
Implementation
Future<MmChannel?> updateChannelPrivacy(
String channelId,
MmUpdateChannelPrivacyRequest mmUpdateChannelPrivacyRequest,
) async {
final response = await updateChannelPrivacyWithHttpInfo(
channelId,
mmUpdateChannelPrivacyRequest,
);
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),
'MmChannel',
) as MmChannel;
}
return null;
}