uploadOrganizationLogoWithHttpInfo method

Future<Response> uploadOrganizationLogoWithHttpInfo(
  1. String org, {
  2. MultipartFile? file,
})

Upload (or replace) the organization logo. Multipart.

Note: This method returns the HTTP Response.

Parameters:

  • String org (required):

  • MultipartFile file:

Implementation

Future<Response> uploadOrganizationLogoWithHttpInfo(String org, { MultipartFile? file, }) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/organizations/{org}/logo'
    .replaceAll('{org}', org);

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  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 (hasFields) {
    postBody = mp;
  }

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