uploadBrandImageWithHttpInfo method

Future<Response> uploadBrandImageWithHttpInfo(
  1. MultipartFile image
)

Upload brand image

Uploads a brand image. ##### Permissions Must have manage_system permission.

Note: This method returns the HTTP Response.

Parameters:

  • MultipartFile image (required): The image to be uploaded

Implementation

Future<Response> uploadBrandImageWithHttpInfo(
  MultipartFile image,
) async {
  // ignore: prefer_const_declarations
  final path = r'/brand/image';

  // 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 (image != null) {
    hasFields = true;
    mp.fields[r'image'] = image.field;
    mp.files.add(image);
  }
  if (hasFields) {
    postBody = mp;
  }

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