setUserProfileImageWithHttpInfo method
Set user profile image
Update a user's profile image
Note: This method returns the HTTP Response
.
Parameters:
-
String userId (required): The ID of the user to update the profile image for
-
MultipartFile
file:
Implementation
Future<http.Response> setUserProfileImageWithHttpInfo(
String userId, {
http.MultipartFile? file,
}) async {
// ignore: prefer_const_declarations
final path =
r'/users/{user_id}/profile_image'.replaceAll('{user_id}', userId);
// 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 = http.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,
);
}