# Cloud Pub/Sub v1 API - Class PublisherServiceApiClient (3.36.0)

3.36.0 (latest) 3.35.0 3.34.0 3.33.0 3.32.0 3.31.0 3.30.0 3.29.0 3.28.0 3.27.0 3.26.0 3.25.0 3.24.0 3.23.0 3.22.0 3.21.0 3.20.0 3.19.0 3.18.0 3.17.0 3.16.0 3.15.0 3.14.0 3.13.0 3.12.0 3.11.0 3.10.1 3.9.1 3.8.0 3.7.0 3.6.0 3.5.1 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0

    public abstract class PublisherServiceApiClient

Reference documentation and code samples for the Cloud Pub/Sub v1 API class PublisherServiceApiClient.

PublisherServiceApi client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> PublisherServiceApiClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[PublisherServiceApiClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClientImpl)

## Namespace

[Google.Cloud.PubSub.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1)

## Assembly

Google.Cloud.PubSub.V1.dll

## Remarks

The service that an application uses to manipulate topics, and to send
messages to a topic.

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the PublisherServiceApi service, which is a host of "pubsub.googleapis.com" and a
port of 443.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default PublisherServiceApi scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default PublisherServiceApi scopes are:

- <https://www.googleapis.com/auth/cloud-platform>
- <https://www.googleapis.com/auth/pubsub>

### GrpcClient

    public virtual Publisher.PublisherClient GrpcClient { get; }

The underlying gRPC PublisherServiceApi client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Publisherhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Publisher.PublisherClient` |   |

### IAMPolicyClient

    public virtual IAMPolicyClient IAMPolicyClient { get; }

The [IAMPolicyClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.IAMPolicyClient.html) associated with this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.IAMPolicyClient.html` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### Create()

    public static PublisherServiceApiClient Create()

Synchronously creates a [PublisherServiceApiClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use
[PublisherServiceApiClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient` | The created [PublisherServiceApiClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient). |

### CreateAsync(CancellationToken)

    public static Task<PublisherServiceApiClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [PublisherServiceApiClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use
[PublisherServiceApiClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient` | The task representing the created [PublisherServiceApiClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient). |

### CreateTopic(Topic, CallSettings)

    public virtual Topic CreateTopic(Topic request, CallSettings callSettings = null)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    Topic request = new Topic
    {
        TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
        Labels = { { "", "" }, },
        MessageStoragePolicy = new MessageStoragePolicy(),
        KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
        SchemaSettings = new SchemaSettings(),
        SatisfiesPzs = false,
        MessageRetentionDuration = new Duration(),
        State = Topic.Types.State.Unspecified,
        IngestionDataSourceSettings = new IngestionDataSourceSettings(),
        MessageTransforms =
        {
            new MessageTransform(),
        },
        Tags = { { "", "" }, },
    };
    // Make the request
    Topic response = publisherServiceApiClient.CreateTopic(request);

### CreateTopic(TopicName, CallSettings)

    public virtual Topic CreateTopic(TopicName name, CallSettings callSettings = null)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. Identifier. The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    TopicName topicName = new TopicName(projectId, topicId);
    Topic topic = client.CreateTopic(topicName);
    Console.WriteLine($"Created {topic.Name}");

### CreateTopic(string, CallSettings)

    public virtual Topic CreateTopic(string name, CallSettings callSettings = null)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. Identifier. The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    string name = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    Topic response = publisherServiceApiClient.CreateTopic(name);

### CreateTopicAsync(Topic, CallSettings)

    public virtual Task<Topic> CreateTopicAsync(Topic request, CallSettings callSettings = null)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    Topic request = new Topic
    {
        TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
        Labels = { { "", "" }, },
        MessageStoragePolicy = new MessageStoragePolicy(),
        KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
        SchemaSettings = new SchemaSettings(),
        SatisfiesPzs = false,
        MessageRetentionDuration = new Duration(),
        State = Topic.Types.State.Unspecified,
        IngestionDataSourceSettings = new IngestionDataSourceSettings(),
        MessageTransforms =
        {
            new MessageTransform(),
        },
        Tags = { { "", "" }, },
    };
    // Make the request
    Topic response = await publisherServiceApiClient.CreateTopicAsync(request);

### CreateTopicAsync(Topic, CancellationToken)

    public virtual Task<Topic> CreateTopicAsync(Topic request, CancellationToken cancellationToken)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    Topic request = new Topic
    {
        TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
        Labels = { { "", "" }, },
        MessageStoragePolicy = new MessageStoragePolicy(),
        KmsKeyNameAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
        SchemaSettings = new SchemaSettings(),
        SatisfiesPzs = false,
        MessageRetentionDuration = new Duration(),
        State = Topic.Types.State.Unspecified,
        IngestionDataSourceSettings = new IngestionDataSourceSettings(),
        MessageTransforms =
        {
            new MessageTransform(),
        },
        Tags = { { "", "" }, },
    };
    // Make the request
    Topic response = await publisherServiceApiClient.CreateTopicAsync(request);

### CreateTopicAsync(TopicName, CallSettings)

    public virtual Task<Topic> CreateTopicAsync(TopicName name, CallSettings callSettings = null)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. Identifier. The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    TopicName topicName = new TopicName(projectId, topicId);
    Topic topic = await client.CreateTopicAsync(topicName);
    Console.WriteLine($"Created {topic.Name}");

### CreateTopicAsync(TopicName, CancellationToken)

    public virtual Task<Topic> CreateTopicAsync(TopicName name, CancellationToken cancellationToken)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. Identifier. The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    TopicName topicName = new TopicName(projectId, topicId);
    Topic topic = await client.CreateTopicAsync(topicName);
    Console.WriteLine($"Created {topic.Name}");

### CreateTopicAsync(string, CallSettings)

    public virtual Task<Topic> CreateTopicAsync(string name, CallSettings callSettings = null)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. Identifier. The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string name = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    Topic response = await publisherServiceApiClient.CreateTopicAsync(name);

### CreateTopicAsync(string, CancellationToken)

    public virtual Task<Topic> CreateTopicAsync(string name, CancellationToken cancellationToken)

Creates the given topic with the given name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. Identifier. The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string name = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    Topic response = await publisherServiceApiClient.CreateTopicAsync(name);

### DeleteTopic(DeleteTopicRequest, CallSettings)

    public virtual void DeleteTopic(DeleteTopicRequest request, CallSettings callSettings = null)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DeleteTopicRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    DeleteTopicRequest request = new DeleteTopicRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    publisherServiceApiClient.DeleteTopic(request);

### DeleteTopic(TopicName, CallSettings)

    public virtual void DeleteTopic(TopicName topic, CallSettings callSettings = null)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    TopicName topicName = new TopicName(projectId, topicId);
    client.DeleteTopic(topicName);
    Console.WriteLine($"Deleted {topicName}");

### DeleteTopic(string, CallSettings)

    public virtual void DeleteTopic(string topic, CallSettings callSettings = null)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    publisherServiceApiClient.DeleteTopic(topic);

### DeleteTopicAsync(DeleteTopicRequest, CallSettings)

    public virtual Task DeleteTopicAsync(DeleteTopicRequest request, CallSettings callSettings = null)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DeleteTopicRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    DeleteTopicRequest request = new DeleteTopicRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    await publisherServiceApiClient.DeleteTopicAsync(request);

### DeleteTopicAsync(DeleteTopicRequest, CancellationToken)

    public virtual Task DeleteTopicAsync(DeleteTopicRequest request, CancellationToken cancellationToken)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DeleteTopicRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    DeleteTopicRequest request = new DeleteTopicRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    await publisherServiceApiClient.DeleteTopicAsync(request);

### DeleteTopicAsync(TopicName, CallSettings)

    public virtual Task DeleteTopicAsync(TopicName topic, CallSettings callSettings = null)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    TopicName topicName = new TopicName(projectId, topicId);
    await client.DeleteTopicAsync(topicName);
    Console.WriteLine($"Deleted {topicName}");

### DeleteTopicAsync(TopicName, CancellationToken)

    public virtual Task DeleteTopicAsync(TopicName topic, CancellationToken cancellationToken)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    TopicName topicName = new TopicName(projectId, topicId);
    await client.DeleteTopicAsync(topicName);
    Console.WriteLine($"Deleted {topicName}");

### DeleteTopicAsync(string, CallSettings)

    public virtual Task DeleteTopicAsync(string topic, CallSettings callSettings = null)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    await publisherServiceApiClient.DeleteTopicAsync(topic);

### DeleteTopicAsync(string, CancellationToken)

    public virtual Task DeleteTopicAsync(string topic, CancellationToken cancellationToken)

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
does not exist. After a topic is deleted, a new topic may be created with
the same name; this is an entirely new topic with none of the old
configuration or subscriptions. Existing subscriptions to this topic are
not deleted, but their `topic` field is set to `_deleted-topic_`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. Name of the topic to delete. Format is `projects/{project}/topics/{topic}`. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    await publisherServiceApiClient.DeleteTopicAsync(topic);

### DetachSubscription(DetachSubscriptionRequest, CallSettings)

    public virtual DetachSubscriptionResponse DetachSubscription(DetachSubscriptionRequest request, CallSettings callSettings = null)

Detaches a subscription from this topic. All messages retained in the
subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
will return FAILED_PRECONDITION. If the subscription is a push
subscription, pushes to the endpoint will stop.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DetachSubscriptionRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DetachSubscriptionResponse` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    DetachSubscriptionRequest request = new DetachSubscriptionRequest
    {
        SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    };
    // Make the request
    DetachSubscriptionResponse response = publisherServiceApiClient.DetachSubscription(request);

### DetachSubscriptionAsync(DetachSubscriptionRequest, CallSettings)

    public virtual Task<DetachSubscriptionResponse> DetachSubscriptionAsync(DetachSubscriptionRequest request, CallSettings callSettings = null)

Detaches a subscription from this topic. All messages retained in the
subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
will return FAILED_PRECONDITION. If the subscription is a push
subscription, pushes to the endpoint will stop.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DetachSubscriptionRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DetachSubscriptionResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    DetachSubscriptionRequest request = new DetachSubscriptionRequest
    {
        SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    };
    // Make the request
    DetachSubscriptionResponse response = await publisherServiceApiClient.DetachSubscriptionAsync(request);

### DetachSubscriptionAsync(DetachSubscriptionRequest, CancellationToken)

    public virtual Task<DetachSubscriptionResponse> DetachSubscriptionAsync(DetachSubscriptionRequest request, CancellationToken cancellationToken)

Detaches a subscription from this topic. All messages retained in the
subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
will return FAILED_PRECONDITION. If the subscription is a push
subscription, pushes to the endpoint will stop.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DetachSubscriptionRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.DetachSubscriptionResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    DetachSubscriptionRequest request = new DetachSubscriptionRequest
    {
        SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    };
    // Make the request
    DetachSubscriptionResponse response = await publisherServiceApiClient.DetachSubscriptionAsync(request);

### GetTopic(GetTopicRequest, CallSettings)

    public virtual Topic GetTopic(GetTopicRequest request, CallSettings callSettings = null)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.GetTopicRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    GetTopicRequest request = new GetTopicRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    Topic response = publisherServiceApiClient.GetTopic(request);

### GetTopic(TopicName, CallSettings)

    public virtual Topic GetTopic(TopicName topic, CallSettings callSettings = null)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The name of the topic to get. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
    // Make the request
    Topic response = publisherServiceApiClient.GetTopic(topic);

### GetTopic(string, CallSettings)

    public virtual Topic GetTopic(string topic, CallSettings callSettings = null)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the topic to get. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    Topic response = publisherServiceApiClient.GetTopic(topic);

### GetTopicAsync(GetTopicRequest, CallSettings)

    public virtual Task<Topic> GetTopicAsync(GetTopicRequest request, CallSettings callSettings = null)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.GetTopicRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    GetTopicRequest request = new GetTopicRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    Topic response = await publisherServiceApiClient.GetTopicAsync(request);

### GetTopicAsync(GetTopicRequest, CancellationToken)

    public virtual Task<Topic> GetTopicAsync(GetTopicRequest request, CancellationToken cancellationToken)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.GetTopicRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    GetTopicRequest request = new GetTopicRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    Topic response = await publisherServiceApiClient.GetTopicAsync(request);

### GetTopicAsync(TopicName, CallSettings)

    public virtual Task<Topic> GetTopicAsync(TopicName topic, CallSettings callSettings = null)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The name of the topic to get. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
    // Make the request
    Topic response = await publisherServiceApiClient.GetTopicAsync(topic);

### GetTopicAsync(TopicName, CancellationToken)

    public virtual Task<Topic> GetTopicAsync(TopicName topic, CancellationToken cancellationToken)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The name of the topic to get. Format is `projects/{project}/topics/{topic}`. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
    // Make the request
    Topic response = await publisherServiceApiClient.GetTopicAsync(topic);

### GetTopicAsync(string, CallSettings)

    public virtual Task<Topic> GetTopicAsync(string topic, CallSettings callSettings = null)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the topic to get. Format is `projects/{project}/topics/{topic}`. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    Topic response = await publisherServiceApiClient.GetTopicAsync(topic);

### GetTopicAsync(string, CancellationToken)

    public virtual Task<Topic> GetTopicAsync(string topic, CancellationToken cancellationToken)

Gets the configuration of a topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the topic to get. Format is `projects/{project}/topics/{topic}`. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    Topic response = await publisherServiceApiClient.GetTopicAsync(topic);

### ListTopicSnapshots(ListTopicSnapshotsRequest, CallSettings)

    public virtual PagedEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshots(ListTopicSnapshotsRequest request, CallSettings callSettings = null)

Lists the names of the snapshots on this topic. Snapshots are used in
[Seek](https://cloud.google.com/pubsub/docs/replay-overview) 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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(request);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSnapshots(TopicName, string, int?, CallSettings)

    public virtual PagedEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshots(TopicName topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the snapshots on this topic. Snapshots are used in
[Seek](https://cloud.google.com/pubsub/docs/replay-overview) 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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The name of the topic that snapshots are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
    // Make the request
    PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(topic);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSnapshots(string, string, int?, CallSettings)

    public virtual PagedEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshots(string topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the snapshots on this topic. Snapshots are used in
[Seek](https://cloud.google.com/pubsub/docs/replay-overview) 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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the topic that snapshots are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    PagedEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshots(topic);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSnapshotsAsync(ListTopicSnapshotsRequest, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshotsAsync(ListTopicSnapshotsRequest request, CallSettings callSettings = null)

Lists the names of the snapshots on this topic. Snapshots are used in
[Seek](https://cloud.google.com/pubsub/docs/replay-overview) 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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable asynchronous sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    ListTopicSnapshotsRequest request = new ListTopicSnapshotsRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(request);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSnapshotsAsync(TopicName, string, int?, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshotsAsync(TopicName topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the snapshots on this topic. Snapshots are used in
[Seek](https://cloud.google.com/pubsub/docs/replay-overview) 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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The name of the topic that snapshots are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable asynchronous sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
    // Make the request
    PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(topic);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSnapshotsAsync(string, string, int?, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> ListTopicSnapshotsAsync(string topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the snapshots on this topic. Snapshots are used in
[Seek](https://cloud.google.com/pubsub/docs/replay-overview) 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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the topic that snapshots are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSnapshotsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable asynchronous sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    PagedAsyncEnumerable<ListTopicSnapshotsResponse, string> response = publisherServiceApiClient.ListTopicSnapshotsAsync(topic);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicSnapshotsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSubscriptions(ListTopicSubscriptionsRequest, CallSettings)

    public virtual PagedEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptions(ListTopicSubscriptionsRequest request, CallSettings callSettings = null)

Lists the names of the attached subscriptions on this topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    ListTopicSubscriptionsRequest request = new ListTopicSubscriptionsRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    PagedEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptions(request);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSubscriptions(TopicName, string, int?, CallSettings)

    public virtual PagedEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptions(TopicName topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the attached subscriptions on this topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The name of the topic that subscriptions are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
    // Make the request
    PagedEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptions(topic);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSubscriptions(string, string, int?, CallSettings)

    public virtual PagedEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptions(string topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the attached subscriptions on this topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the topic that subscriptions are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    PagedEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptions(topic);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest request, CallSettings callSettings = null)

Lists the names of the attached subscriptions on this topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable asynchronous sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    ListTopicSubscriptionsRequest request = new ListTopicSubscriptionsRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    };
    // Make the request
    PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptionsAsync(request);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSubscriptionsAsync(TopicName, string, int?, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptionsAsync(TopicName topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the attached subscriptions on this topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The name of the topic that subscriptions are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable asynchronous sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    TopicName topic = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]");
    // Make the request
    PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptionsAsync(topic);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicSubscriptionsAsync(string, string, int?, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> ListTopicSubscriptionsAsync(string topic, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the names of the attached subscriptions on this topic.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the topic that subscriptions are attached to. Format is `projects/{project}/topics/{topic}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicSubscriptionsResponsehttps://learn.microsoft.com/dotnet/api/system.string` | A pageable asynchronous sequence of [string](https://learn.microsoft.com/dotnet/api/system.string) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    // Make the request
    PagedAsyncEnumerable<ListTopicSubscriptionsResponse, string> response = publisherServiceApiClient.ListTopicSubscriptionsAsync(topic);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (string item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicSubscriptionsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (string item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<string> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (string item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopics(ProjectName, string, int?, CallSettings)

    public virtual PagedEnumerable<ListTopicsResponse, Topic> ListTopics(ProjectName project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching topics.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.ProjectName.html` Required. The name of the project in which to list topics. Format is `projects/{project-id}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A pageable sequence of [Topic](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic) resources. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    ProjectName projectName = new ProjectName(projectId);
    foreach (Topic topic in client.ListTopics(projectName))
    {
        Console.WriteLine(topic.Name);
    }

### ListTopics(ListTopicsRequest, CallSettings)

    public virtual PagedEnumerable<ListTopicsResponse, Topic> ListTopics(ListTopicsRequest request, CallSettings callSettings = null)

Lists matching topics.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A pageable sequence of [Topic](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    ListTopicsRequest request = new ListTopicsRequest
    {
        ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
    };
    // Make the request
    PagedEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopics(request);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (Topic item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Topic item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Topic> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Topic item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopics(string, string, int?, CallSettings)

    public virtual PagedEnumerable<ListTopicsResponse, Topic> ListTopics(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching topics.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the project in which to list topics. Format is `projects/{project-id}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A pageable sequence of [Topic](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    string project = "projects/[PROJECT]";
    // Make the request
    PagedEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopics(project);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (Topic item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListTopicsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Topic item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Topic> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Topic item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicsAsync(ProjectName, string, int?, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicsResponse, Topic> ListTopicsAsync(ProjectName project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching topics.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.ProjectName.html` Required. The name of the project in which to list topics. Format is `projects/{project-id}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A pageable asynchronous sequence of [Topic](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic) resources. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();

    ProjectName projectName = new ProjectName(projectId);
    IAsyncEnumerable<Topic> topics = client.ListTopicsAsync(projectName);
    await foreach (Topic topic in topics)
    {
        Console.WriteLine(topic.Name);
    }

### ListTopicsAsync(ListTopicsRequest, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicsResponse, Topic> ListTopicsAsync(ListTopicsRequest request, CallSettings callSettings = null)

Lists matching topics.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A pageable asynchronous sequence of [Topic](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    ListTopicsRequest request = new ListTopicsRequest
    {
        ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
    };
    // Make the request
    PagedAsyncEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopicsAsync(request);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (Topic item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Topic item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Topic> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Topic item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListTopicsAsync(string, string, int?, CallSettings)

    public virtual PagedAsyncEnumerable<ListTopicsResponse, Topic> ListTopicsAsync(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching topics.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The name of the project in which to list topics. Format is `projects/{project-id}`. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.ListTopicsResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A pageable asynchronous sequence of [Topic](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic) resources. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string project = "projects/[PROJECT]";
    // Make the request
    PagedAsyncEnumerable<ListTopicsResponse, Topic> response = publisherServiceApiClient.ListTopicsAsync(project);

    // Iterate over all response items, lazily performing RPCs as required
    await foreach (Topic item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await foreach (ListTopicsResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Topic item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Topic> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Topic item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### Publish(PublishRequest, CallSettings)

    public virtual PublishResponse Publish(PublishRequest request, CallSettings callSettings = null)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    PublishRequest request = new PublishRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
        Messages =
        {
            new PubsubMessage(),
        },
    };
    // Make the request
    PublishResponse response = publisherServiceApiClient.Publish(request);

### Publish(TopicName, IEnumerable\<PubsubMessage\>, CallSettings)

    public virtual PublishResponse Publish(TopicName topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The messages in the request will be published on this topic. Format is `projects/{project}/topics/{topic}`. |
| `messages` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PubsubMessage` Required. The messages to publish. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | The RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();
    // Make sure we have a topic to publish to
    TopicName topicName = new TopicName(projectId, topicId);
    client.CreateTopic(topicName);

    PubsubMessage message = new PubsubMessage
    {
        // The data is any arbitrary ByteString. Here, we're using text.
        Data = ByteString.CopyFromUtf8("Hello, Pubsub"),
        // The attributes provide metadata in a string-to-string dictionary.
        Attributes =
        {
            { "description", "Simple text message" }
        }
    };
    client.Publish(topicName, new[] { message });

### Publish(string, IEnumerable\<PubsubMessage\>, CallSettings)

    public virtual PublishResponse Publish(string topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The messages in the request will be published on this topic. Format is `projects/{project}/topics/{topic}`. |
| `messages` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PubsubMessage` Required. The messages to publish. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    IEnumerable<PubsubMessage> messages = new PubsubMessage[]
    {
        new PubsubMessage(),
    };
    // Make the request
    PublishResponse response = publisherServiceApiClient.Publish(topic, messages);

### PublishAsync(PublishRequest, CallSettings)

    public virtual Task<PublishResponse> PublishAsync(PublishRequest request, CallSettings callSettings = null)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    PublishRequest request = new PublishRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
        Messages =
        {
            new PubsubMessage(),
        },
    };
    // Make the request
    PublishResponse response = await publisherServiceApiClient.PublishAsync(request);

### PublishAsync(PublishRequest, CancellationToken)

    public virtual Task<PublishResponse> PublishAsync(PublishRequest request, CancellationToken cancellationToken)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    PublishRequest request = new PublishRequest
    {
        TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
        Messages =
        {
            new PubsubMessage(),
        },
    };
    // Make the request
    PublishResponse response = await publisherServiceApiClient.PublishAsync(request);

### PublishAsync(TopicName, IEnumerable\<PubsubMessage\>, CallSettings)

    public virtual Task<PublishResponse> PublishAsync(TopicName topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The messages in the request will be published on this topic. Format is `projects/{project}/topics/{topic}`. |
| `messages` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PubsubMessage` Required. The messages to publish. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | A Task containing the RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();
    // Make sure we have a topic to publish to
    TopicName topicName = new TopicName(projectId, topicId);
    await client.CreateTopicAsync(topicName);

    PubsubMessage message = new PubsubMessage
    {
        // The data is any arbitrary ByteString. Here, we're using text.
        Data = ByteString.CopyFromUtf8("Hello, Pubsub"),
        // The attributes provide metadata in a string-to-string dictionary.
        Attributes =
        {
            { "description", "Simple text message" }
        }
    };
    await client.PublishAsync(topicName, new[] { message });

### PublishAsync(TopicName, IEnumerable\<PubsubMessage\>, CancellationToken)

    public virtual Task<PublishResponse> PublishAsync(TopicName topic, IEnumerable<PubsubMessage> messages, CancellationToken cancellationToken)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName` Required. The messages in the request will be published on this topic. Format is `projects/{project}/topics/{topic}`. |
| `messages` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PubsubMessage` Required. The messages to publish. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | A Task containing the RPC response. |

**Example**

    PublisherServiceApiClient client = PublisherServiceApiClient.Create();
    // Make sure we have a topic to publish to
    TopicName topicName = new TopicName(projectId, topicId);
    await client.CreateTopicAsync(topicName);

    PubsubMessage message = new PubsubMessage
    {
        // The data is any arbitrary ByteString. Here, we're using text.
        Data = ByteString.CopyFromUtf8("Hello, Pubsub"),
        // The attributes provide metadata in a string-to-string dictionary.
        Attributes =
        {
            { "description", "Simple text message" }
        }
    };
    await client.PublishAsync(topicName, new[] { message });

### PublishAsync(string, IEnumerable\<PubsubMessage\>, CallSettings)

    public virtual Task<PublishResponse> PublishAsync(string topic, IEnumerable<PubsubMessage> messages, CallSettings callSettings = null)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The messages in the request will be published on this topic. Format is `projects/{project}/topics/{topic}`. |
| `messages` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PubsubMessage` Required. The messages to publish. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    IEnumerable<PubsubMessage> messages = new PubsubMessage[]
    {
        new PubsubMessage(),
    };
    // Make the request
    PublishResponse response = await publisherServiceApiClient.PublishAsync(topic, messages);

### PublishAsync(string, IEnumerable\<PubsubMessage\>, CancellationToken)

    public virtual Task<PublishResponse> PublishAsync(string topic, IEnumerable<PubsubMessage> messages, CancellationToken cancellationToken)

Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
does not exist.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The messages in the request will be published on this topic. Format is `projects/{project}/topics/{topic}`. |
| `messages` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PubsubMessage` Required. The messages to publish. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublishResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    string topic = "projects/[PROJECT]/topics/[TOPIC]";
    IEnumerable<PubsubMessage> messages = new PubsubMessage[]
    {
        new PubsubMessage(),
    };
    // Make the request
    PublishResponse response = await publisherServiceApiClient.PublishAsync(topic, messages);

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient#Google_Cloud_PubSub_V1_PublisherServiceApiClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient#Google_Cloud_PubSub_V1_PublisherServiceApiClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient#Google_Cloud_PubSub_V1_PublisherServiceApiClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.PublisherServiceApiClient#Google_Cloud_PubSub_V1_PublisherServiceApiClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.

### UpdateTopic(Topic, FieldMask, CallSettings)

    public virtual Topic UpdateTopic(Topic topic, FieldMask updateMask, CallSettings callSettings = null)

Updates an existing topic by updating the fields specified in the update
mask. Note that certain properties of a topic are not modifiable.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` Required. The updated topic object. |
| `updateMask` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.FieldMask.html` Required. Indicates which fields in the provided topic to update. Must be specified and non-empty. Note that if `update_mask` contains "message_storage_policy" but the `message_storage_policy` is not set in the `topic` provided above, then the updated value is determined by the policy configured at the project or organization level. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    Topic topic = new Topic();
    FieldMask updateMask = new FieldMask();
    // Make the request
    Topic response = publisherServiceApiClient.UpdateTopic(topic, updateMask);

### UpdateTopic(UpdateTopicRequest, CallSettings)

    public virtual Topic UpdateTopic(UpdateTopicRequest request, CallSettings callSettings = null)

Updates an existing topic by updating the fields specified in the update
mask. Note that certain properties of a topic are not modifiable.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.UpdateTopicRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | The RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = PublisherServiceApiClient.Create();
    // Initialize request argument(s)
    UpdateTopicRequest request = new UpdateTopicRequest
    {
        Topic = new Topic(),
        UpdateMask = new FieldMask(),
    };
    // Make the request
    Topic response = publisherServiceApiClient.UpdateTopic(request);

### UpdateTopicAsync(Topic, FieldMask, CallSettings)

    public virtual Task<Topic> UpdateTopicAsync(Topic topic, FieldMask updateMask, CallSettings callSettings = null)

Updates an existing topic by updating the fields specified in the update
mask. Note that certain properties of a topic are not modifiable.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` Required. The updated topic object. |
| `updateMask` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.FieldMask.html` Required. Indicates which fields in the provided topic to update. Must be specified and non-empty. Note that if `update_mask` contains "message_storage_policy" but the `message_storage_policy` is not set in the `topic` provided above, then the updated value is determined by the policy configured at the project or organization level. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    Topic topic = new Topic();
    FieldMask updateMask = new FieldMask();
    // Make the request
    Topic response = await publisherServiceApiClient.UpdateTopicAsync(topic, updateMask);

### UpdateTopicAsync(Topic, FieldMask, CancellationToken)

    public virtual Task<Topic> UpdateTopicAsync(Topic topic, FieldMask updateMask, CancellationToken cancellationToken)

Updates an existing topic by updating the fields specified in the update
mask. Note that certain properties of a topic are not modifiable.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `topic` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` Required. The updated topic object. |
| `updateMask` | `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.FieldMask.html` Required. Indicates which fields in the provided topic to update. Must be specified and non-empty. Note that if `update_mask` contains "message_storage_policy" but the `message_storage_policy` is not set in the `topic` provided above, then the updated value is determined by the policy configured at the project or organization level. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    Topic topic = new Topic();
    FieldMask updateMask = new FieldMask();
    // Make the request
    Topic response = await publisherServiceApiClient.UpdateTopicAsync(topic, updateMask);

### UpdateTopicAsync(UpdateTopicRequest, CallSettings)

    public virtual Task<Topic> UpdateTopicAsync(UpdateTopicRequest request, CallSettings callSettings = null)

Updates an existing topic by updating the fields specified in the update
mask. Note that certain properties of a topic are not modifiable.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.UpdateTopicRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    UpdateTopicRequest request = new UpdateTopicRequest
    {
        Topic = new Topic(),
        UpdateMask = new FieldMask(),
    };
    // Make the request
    Topic response = await publisherServiceApiClient.UpdateTopicAsync(request);

### UpdateTopicAsync(UpdateTopicRequest, CancellationToken)

    public virtual Task<Topic> UpdateTopicAsync(UpdateTopicRequest request, CancellationToken cancellationToken)

Updates an existing topic by updating the fields specified in the update
mask. Note that certain properties of a topic are not modifiable.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.UpdateTopicRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic` | A Task containing the RPC response. |

**Example**

    // Create client
    PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();
    // Initialize request argument(s)
    UpdateTopicRequest request = new UpdateTopicRequest
    {
        Topic = new Topic(),
        UpdateMask = new FieldMask(),
    };
    // Make the request
    Topic response = await publisherServiceApiClient.UpdateTopicAsync(request);