updateChannelMemberSchemeRoles method

Future<MmStatusOK?> updateChannelMemberSchemeRoles(
  1. String channelId,
  2. String userId,
  3. MmUpdateTeamMemberSchemeRolesRequest mmUpdateTeamMemberSchemeRolesRequest
)

Update the scheme-derived roles of a channel member.

Update a channel member's scheme_admin/scheme_user properties. Typically this should either be scheme_admin=false, scheme_user=true for ordinary channel member, or scheme_admin=true, scheme_user=true for a channel admin. Minimum server version: 5.0 ##### Permissions Must be authenticated and have the manage_channel_roles permission.

Parameters:

Implementation

Future<MmStatusOK?> updateChannelMemberSchemeRoles(
  String channelId,
  String userId,
  MmUpdateTeamMemberSchemeRolesRequest mmUpdateTeamMemberSchemeRolesRequest,
) async {
  final response = await updateChannelMemberSchemeRolesWithHttpInfo(
    channelId,
    userId,
    mmUpdateTeamMemberSchemeRolesRequest,
  );
  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;
}