listSnapshots method

Future<ListSnapshotsResponse> listSnapshots({
  1. int? pageSize,
  2. String? pageToken,
  3. String? project,
  4. int retries = 5,
})

Lists the existing snapshots. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

If set, the project can be either just the project id or it can be the fully quantified format: projects/{project}. If not set, the project from the service account will be used.

Implementation

Future<ListSnapshotsResponse> listSnapshots({
  int? pageSize,
  String? pageToken,
  String? project,
  int retries = 5,
}) async {
  assert(_initialized);
  final projectId = project ?? _projectId;
  _logger.fine('[listSnapshots]: start -- [$projectId]');

  try {
    return await _execute(
      executor: () async {
        final result = await _pubsubApi.projects.snapshots.list(
          projectId.startsWith('projects/')
              ? projectId
              : 'projects/$projectId',
          pageSize: pageSize,
          pageToken: pageToken,
        );

        return result;
      },
      retries: retries,
    );
  } finally {
    _logger.fine('[listSnapshots]: complete -- [$projectId]');
  }
}