importTeam method

Future<MmImportTeam200Response?> importTeam(
  1. String teamId,
  2. MultipartFile file,
  3. int filesize,
  4. String importFrom,
)

Import a Team from other application

Import a team into a existing team. Import users, channels, posts, hooks. ##### Permissions Must have permission_import_team permission.

Parameters:

  • String teamId (required): Team GUID

  • MultipartFile file (required): A file to be uploaded in zip format.

  • int filesize (required): The size of the zip file to be imported.

  • String importFrom (required): String that defines from which application the team was exported to be imported into Mattermost.

Implementation

Future<MmImportTeam200Response?> importTeam(
  String teamId,
  MultipartFile file,
  int filesize,
  String importFrom,
) async {
  final response = await importTeamWithHttpInfo(
    teamId,
    file,
    filesize,
    importFrom,
  );
  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),
      'MmImportTeam200Response',
    ) as MmImportTeam200Response;
  }
  return null;
}