updateTopic method

Future<Topic> updateTopic({
  1. int retries = 5,
  2. required Topic topic,
  3. required String updateMask,
})

Updates an existing topic. Note that certain properties of a topic are not modifiable.

Set the list of fields to update via the updateMask.

Implementation

Future<Topic> updateTopic({
  int retries = 5,
  required Topic topic,
  required String updateMask,
}) async {
  assert(_initialized);
  assert(updateMask.isNotEmpty);

  _logger.fine('[updateTopic]: start -- [$topic]');
  try {
    return await _execute(
      executor: () async {
        final result = await _pubsubApi.projects.topics.patch(
          UpdateTopicRequest(
            topic: topic,
            updateMask: updateMask,
          ),
          topic.name!,
        );

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