listPushChannels method

Future<ListPushChannelsResult> listPushChannels(
  1. String deviceId,
  2. PushGateway gateway, {
  3. String? topic,
  4. Environment? environment,
  5. String? start,
  6. int? count,
  7. Keyset? keyset,
  8. String? using,
})
inherited

It returns list of all channels to which device deviceId is registered to receive push notifications.

deviceId is the id/token of the device. gateway indicates the backend to use for push service:

  • apns or apns2 for Apple service.
  • gcm for Google service.
  • mpns for Microsoft service.

If gateway is PushGateway.apns2 then topic is mandatory to provide. topic is bundle id of the mobile application. environment denoting the environment of the mobile application for PushGateway.apns2, it can be either: start Starting channel for pagination. Use the last channel from the previous page request. count Number of channels to return for pagination. Max of 1000 tokens at a time. Defaults to 500.

Implementation

Future<ListPushChannelsResult> listPushChannels(
    String deviceId, PushGateway gateway,
    {String? topic,
    Environment? environment,
    String? start,
    int? count,
    Keyset? keyset,
    String? using}) async {
  keyset ??= keysets[using];

  Ensure(deviceId).isNotEmpty('deviceId');
  if (gateway == PushGateway.apns2) Ensure(topic).isNotNull('topic');

  var params = ListPushChannelsParams(
    keyset,
    deviceId,
    gateway,
    topic: topic,
    environment: environment,
    start: start,
    count: count,
  );
  return defaultFlow<ListPushChannelsParams, ListPushChannelsResult>(
      keyset: keyset,
      core: this,
      params: params,
      serialize: (object, [_]) => ListPushChannelsResult.fromJson(object));
}