setBotIconImageWithHttpInfo method

Future<Response> setBotIconImageWithHttpInfo(
  1. String botUserId,
  2. MultipartFile image
)

Set bot's LHS icon image

Set a bot's LHS icon image based on bot_user_id string parameter. Icon image must be SVG format, all other formats are rejected. ##### Permissions Must have manage_bots permission. Minimum server version: 5.14

Note: This method returns the HTTP Response.

Parameters:

  • String botUserId (required): Bot user ID

  • MultipartFile image (required): SVG icon image to be uploaded

Implementation

Future<Response> setBotIconImageWithHttpInfo(
  String botUserId,
  MultipartFile image,
) async {
  // ignore: prefer_const_declarations
  final path = r'/bots/{bot_user_id}/icon'.replaceAll('{bot_user_id}', botUserId);

  // 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,
  );
}