listTopics method

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

Lists matching topics. 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<ListTopicsResponse> listTopics({
  int? pageSize,
  String? pageToken,
  String? project,
  int retries = 5,
}) async {
  assert(_initialized);
  final projectId = project ?? _projectId;
  _logger.fine('[listTopics]: start -- [$projectId]');

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

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