getPresets method

Future<List<Preset>> getPresets(
  1. String profileToken, {
  2. int? limit = 100,
})

Operation to request all PTZ presets for the Preset in the selected profile. The operation is supported if there is support for at least one PTZ preset by the Preset.

ACCESS CLASS: READ_MEDIA

Implementation

Future<List<Preset>> getPresets(String profileToken,
    {int? limit = 100}) async {
  loggy.debug('getPresets');

  final responseEnvelope = await transport.securedRequest(
      uri,
      soap.Body(
        request: PtzRequest.getPresets(profileToken),
      ));

  if (responseEnvelope.body.response == null) throw Exception();

  final presets =
      GetPresetsResponse.fromJson(responseEnvelope.body.response!).presets;

  limit = (limit! > presets.length) ? presets.length : limit;

  return GetPresetsResponse.fromJson(responseEnvelope.body.response!)
      .presets
      .sublist(0, limit);
}