createEmojiWithHttpInfo method

Future<Response> createEmojiWithHttpInfo(
  1. MultipartFile image,
  2. String emoji
)

Create a custom emoji

Create a custom emoji for the team. ##### Permissions Must be authenticated.

Note: This method returns the HTTP Response.

Parameters:

  • MultipartFile image (required): A file to be uploaded

  • String emoji (required): A JSON object containing a name field with the name of the emoji and a creator_id field with the id of the authenticated user.

Implementation

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

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

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