inviteUsersToTeam method

Future<MmStatusOK?> inviteUsersToTeam(
  1. String teamId,
  2. List<String> requestBody
)

Invite users to the team by email

Invite users to the existing team using the user's email. The number of emails that can be sent is rate limited to 20 per hour with a burst of 20 emails. If the rate limit exceeds, the error message contains details on when to retry and when the timer will be reset. ##### Permissions Must have invite_user and add_user_to_team permissions for the team.

Parameters:

  • String teamId (required): Team GUID

  • List<String> requestBody (required): List of user's email

Implementation

Future<MmStatusOK?> inviteUsersToTeam(
  String teamId,
  List<String> requestBody,
) async {
  final response = await inviteUsersToTeamWithHttpInfo(
    teamId,
    requestBody,
  );
  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;
}