importTeamWithHttpInfo method

Future<Response> importTeamWithHttpInfo(
  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.

Note: This method returns the HTTP Response.

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<Response> importTeamWithHttpInfo(
  String teamId,
  MultipartFile file,
  int filesize,
  String importFrom,
) async {
  // ignore: prefer_const_declarations
  final path = r'/teams/{team_id}/import'.replaceAll('{team_id}', teamId);

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <MmQueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['multipart/form-data'];

  bool hasFields = false;
  final mp = MultipartRequest('POST', Uri.parse(path));
  if (file != null) {
    hasFields = true;
    mp.fields[r'file'] = file.field;
    mp.files.add(file);
  }
  if (filesize != null) {
    hasFields = true;
    mp.fields[r'filesize'] = parameterToString(filesize);
  }
  if (importFrom != null) {
    hasFields = true;
    mp.fields[r'importFrom'] = parameterToString(importFrom);
  }
  if (hasFields) {
    postBody = mp;
  }

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}