updateApp method
Future<UpdateAppResponseDto>
updateApp(
- String apiKey, {
- required String appId,
- required String releaseLabelId,
- required UpdateAppRequestDto updateAppRequestDto,
Implementation
Future<UpdateAppResponseDto> updateApp(
String apiKey, {
required String appId,
required String releaseLabelId,
required UpdateAppRequestDto updateAppRequestDto,
}) async {
final String url = '$channel/api/v1/mdm/apps/$appId/labels/$releaseLabelId';
final requestDto = updateAppRequestDto.toJson();
requestDto.removeWhere((key, value) => value == null);
final response = await http.put(
Uri.parse(url),
headers: {
'Authorization': 'Zoho-oauthtoken $apiKey',
'Content-Type': 'application/json;charset=UTF-8',
},
body: requestDto.isEmpty ? null : jsonEncode(requestDto),
);
if (!response.statusCode.isSuccessful) {
throw MdmEngineException(
method: response.request?.method,
url: url,
statusCode: response.statusCode,
error: response.body,
);
}
return UpdateAppResponseDto.fromJson(
jsonDecode(
response.body,
),
);
}