disassociateProfilesFromGroup method

Future<MdmEmpty> disassociateProfilesFromGroup(
  1. String apiKey, {
  2. required String groupId,
  3. required DisassociateProfilesFromInMdmRequestDto disassociateProfilesFromGroupRequestDto,
})

Implementation

Future<MdmEmpty> disassociateProfilesFromGroup(
  String apiKey, {
  required String groupId,
  required DisassociateProfilesFromInMdmRequestDto
      disassociateProfilesFromGroupRequestDto,
}) async {
  final String url = '$channel/api/v1/mdm/groups/$groupId/profiles';

  final requestDto = disassociateProfilesFromGroupRequestDto.toJson();
  requestDto.removeWhere((key, value) => value == null);

  final response = await http.delete(
    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 MdmEmpty();
}