setProfileImageWithHttpInfo method
Set user's profile image
Set a user's profile image based on user_id string parameter. ##### Permissions Must be logged in as the user being updated or have the edit_other_users
permission.
Note: This method returns the HTTP Response
.
Parameters:
-
String userId (required): User GUID
-
MultipartFile
image (required): The image to be uploaded
Implementation
Future<Response> setProfileImageWithHttpInfo(
String userId,
MultipartFile image,
) async {
// ignore: prefer_const_declarations
final path = r'/users/{user_id}/image'.replaceAll('{user_id}', userId);
// 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,
);
}