getDeviceRestrictions method

Future<GetDeviceRestrictionsResponseDto> getDeviceRestrictions(
  1. String apiKey, {
  2. required String deviceId,
})

Implementation

Future<GetDeviceRestrictionsResponseDto> getDeviceRestrictions(
  String apiKey, {
  required String deviceId,
}) async {
  final String url = '$channel/api/v1/mdm/devices/$deviceId/restrictions';

  final response = await http.get(
    Uri.parse(url),
    headers: {
      'Authorization': 'Zoho-oauthtoken $apiKey',
      'Content-Type': 'application/json;charset=UTF-8',
    },
  );

  if (!response.statusCode.isSuccessful) {
    throw MdmEngineException(
      method: response.request?.method,
      url: url,
      statusCode: response.statusCode,
      error: response.body,
    );
  }

  return GetDeviceRestrictionsResponseDto.fromJson(
    jsonDecode(response.body) as Map<String, dynamic>,
  );
}