promoteGuestToUser method

Future<MmStatusOK?> promoteGuestToUser(
  1. String userId
)

Promote a guest to user

Convert a guest into a regular user. This will convert the guest into a user for the whole system while retaining any team and channel memberships and automatically joining them to the default channels. Minimum server version: 5.16 ##### Permissions Must be logged in as the user or have the promote_guest permission.

Parameters:

  • String userId (required): User GUID

Implementation

Future<MmStatusOK?> promoteGuestToUser(
  String userId,
) async {
  final response = await promoteGuestToUserWithHttpInfo(
    userId,
  );
  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;
}