Class PublisherServiceApiClient (2.6.0)

public abstract class PublisherServiceApiClient

PublisherServiceApi client wrapper, for convenient use.

Inheritance

Object > PublisherServiceApiClient

Namespace

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
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default PublisherServiceApi scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual Publisher.PublisherClient GrpcClient { get; }

The underlying gRPC PublisherServiceApi client

Property Value
TypeDescription
Publisher.PublisherClient

Methods

Create()

public static PublisherServiceApiClient Create()

Synchronously creates a PublisherServiceApiClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PublisherServiceApiClientBuilder.

Returns
TypeDescription
PublisherServiceApiClient

The created PublisherServiceApiClient.

CreateAsync(CancellationToken)

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

Asynchronously creates a PublisherServiceApiClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PublisherServiceApiClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<PublisherServiceApiClient>

The task representing the created 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.

Parameters
NameDescription
requestTopic

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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(),
    KmsKeyName = "",
    SchemaSettings = new SchemaSettings(),
    SatisfiesPzs = false,
};
// 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.

Parameters
NameDescription
nameTopicName

Required. The name of the topic. It must have the format &quot;projects/{project}/topics/{topic}&quot;. {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 &quot;goog&quot;.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.

Parameters
NameDescription
nameString

Required. The name of the topic. It must have the format &quot;projects/{project}/topics/{topic}&quot;. {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 &quot;goog&quot;.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.

Parameters
NameDescription
requestTopic

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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(),
    KmsKeyName = "",
    SchemaSettings = new SchemaSettings(),
    SatisfiesPzs = false,
};
// 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.

Parameters
NameDescription
requestTopic

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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(),
    KmsKeyName = "",
    SchemaSettings = new SchemaSettings(),
    SatisfiesPzs = false,
};
// 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.

Parameters
NameDescription
nameTopicName

Required. The name of the topic. It must have the format &quot;projects/{project}/topics/{topic}&quot;. {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 &quot;goog&quot;.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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.

Parameters
NameDescription
nameTopicName

Required. The name of the topic. It must have the format &quot;projects/{project}/topics/{topic}&quot;. {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 &quot;goog&quot;.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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.

Parameters
NameDescription
nameString

Required. The name of the topic. It must have the format &quot;projects/{project}/topics/{topic}&quot;. {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 &quot;goog&quot;.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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.

Parameters
NameDescription
nameString

Required. The name of the topic. It must have the format &quot;projects/{project}/topics/{topic}&quot;. {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 &quot;goog&quot;.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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
NameDescription
requestDeleteTopicRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

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
NameDescription
topicTopicName

Required. Name of the topic to delete. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

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
NameDescription
topicString

Required. Name of the topic to delete. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

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
NameDescription
requestDeleteTopicRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestDeleteTopicRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
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
NameDescription
topicTopicName

Required. Name of the topic to delete. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
topicTopicName

Required. Name of the topic to delete. Format is projects/{project}/topics/{topic}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
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
NameDescription
topicString

Required. Name of the topic to delete. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
topicString

Required. Name of the topic to delete. Format is projects/{project}/topics/{topic}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
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
NameDescription
requestDetachSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestDetachSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
requestDetachSubscriptionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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);

GetIamPolicy(IResourceName, CallSettings)

public virtual Policy GetIamPolicy(IResourceName resource, CallSettings callSettings = null)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public virtual Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

GetIamPolicy(String, CallSettings)

public virtual Policy GetIamPolicy(string resource, CallSettings callSettings = null)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
PublisherServiceApiClient client = PublisherServiceApiClient.Create();
string topicName = new TopicName(projectId, topicId).ToString();
Policy policy = client.GetIamPolicy(topicName);
Console.WriteLine($"Policy for {topicName}: {policy}");

GetIamPolicyAsync(IResourceName, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CallSettings callSettings = null)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(IResourceName, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CancellationToken cancellationToken)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CancellationToken cancellationToken)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(String, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CallSettings callSettings = null)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(String, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CancellationToken cancellationToken)

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetTopic(GetTopicRequest, CallSettings)

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

Gets the configuration of a topic.

Parameters
NameDescription
requestGetTopicRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
topicTopicName

Required. The name of the topic to get. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
topicString

Required. The name of the topic to get. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestGetTopicRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
requestGetTopicRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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
NameDescription
topicTopicName

Required. The name of the topic to get. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
topicTopicName

Required. The name of the topic to get. Format is projects/{project}/topics/{topic}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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
NameDescription
topicString

Required. The name of the topic to get. Format is projects/{project}/topics/{topic}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
topicString

Required. The name of the topic to get. Format is projects/{project}/topics/{topic}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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);

ListTopics(ProjectName, String, Nullable<Int32>, CallSettings)

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

Lists matching topics.

Parameters
NameDescription
projectProjectName

Required. The name of the project in which to list topics. Format is projects/{project-id}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicsResponse, Topic>

A pageable sequence of 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
NameDescription
requestListTopicsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicsResponse, Topic>

A pageable sequence of 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, Nullable<Int32>, CallSettings)

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

Lists matching topics.

Parameters
NameDescription
projectString

Required. The name of the project in which to list topics. Format is projects/{project-id}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicsResponse, Topic>

A pageable sequence of 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, Nullable<Int32>, CallSettings)

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

Lists matching topics.

Parameters
NameDescription
projectProjectName

Required. The name of the project in which to list topics. Format is projects/{project-id}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicsResponse, Topic>

A pageable asynchronous sequence of Topic resources.

Example
PublisherServiceApiClient client = PublisherServiceApiClient.Create();

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

ListTopicsAsync(ListTopicsRequest, CallSettings)

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

Lists matching topics.

Parameters
NameDescription
requestListTopicsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicsResponse, Topic>

A pageable asynchronous sequence of 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 response.ForEachAsync((Topic item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicsResponse page) =>
{
    // 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, Nullable<Int32>, CallSettings)

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

Lists matching topics.

Parameters
NameDescription
projectString

Required. The name of the project in which to list topics. Format is projects/{project-id}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicsResponse, Topic>

A pageable asynchronous sequence of 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 response.ForEachAsync((Topic item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicsResponse page) =>
{
    // 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;

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 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
NameDescription
requestListTopicSnapshotsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicSnapshotsResponse, String>

A pageable sequence of 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, Nullable<Int32>, CallSettings)

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

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

Parameters
NameDescription
topicTopicName

Required. The name of the topic that snapshots are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicSnapshotsResponse, String>

A pageable sequence of 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, Nullable<Int32>, CallSettings)

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

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

Parameters
NameDescription
topicString

Required. The name of the topic that snapshots are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicSnapshotsResponse, String>

A pageable sequence of 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 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
NameDescription
requestListTopicSnapshotsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicSnapshotsResponse, String>

A pageable asynchronous sequence of 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 response.ForEachAsync((string item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
{
    // 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, Nullable<Int32>, CallSettings)

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

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

Parameters
NameDescription
topicTopicName

Required. The name of the topic that snapshots are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicSnapshotsResponse, String>

A pageable asynchronous sequence of 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 response.ForEachAsync((string item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
{
    // 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, Nullable<Int32>, CallSettings)

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

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

Parameters
NameDescription
topicString

Required. The name of the topic that snapshots are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicSnapshotsResponse, String>

A pageable asynchronous sequence of 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 response.ForEachAsync((string item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSnapshotsResponse page) =>
{
    // 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
NameDescription
requestListTopicSubscriptionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicSubscriptionsResponse, String>

A pageable sequence of 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, Nullable<Int32>, CallSettings)

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

Lists the names of the attached subscriptions on this topic.

Parameters
NameDescription
topicTopicName

Required. The name of the topic that subscriptions are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicSubscriptionsResponse, String>

A pageable sequence of 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, Nullable<Int32>, CallSettings)

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

Lists the names of the attached subscriptions on this topic.

Parameters
NameDescription
topicString

Required. The name of the topic that subscriptions are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTopicSubscriptionsResponse, String>

A pageable sequence of 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
NameDescription
requestListTopicSubscriptionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, String>

A pageable asynchronous sequence of 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 response.ForEachAsync((string item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSubscriptionsResponse page) =>
{
    // 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, Nullable<Int32>, CallSettings)

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

Lists the names of the attached subscriptions on this topic.

Parameters
NameDescription
topicTopicName

Required. The name of the topic that subscriptions are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, String>

A pageable asynchronous sequence of 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 response.ForEachAsync((string item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSubscriptionsResponse page) =>
{
    // 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, Nullable<Int32>, CallSettings)

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

Lists the names of the attached subscriptions on this topic.

Parameters
NameDescription
topicString

Required. The name of the topic that subscriptions are attached to. Format is projects/{project}/topics/{topic}.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTopicSubscriptionsResponse, String>

A pageable asynchronous sequence of 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 response.ForEachAsync((string item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTopicSubscriptionsResponse page) =>
{
    // 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;

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
NameDescription
requestPublishRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
topicTopicName

Required. The messages in the request will be published on this topic. Format is projects/{project}/topics/{topic}.

messagesIEnumerable<PubsubMessage>

Required. The messages to publish.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
topicString

Required. The messages in the request will be published on this topic. Format is projects/{project}/topics/{topic}.

messagesIEnumerable<PubsubMessage>

Required. The messages to publish.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestPublishRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
requestPublishRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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
NameDescription
topicTopicName

Required. The messages in the request will be published on this topic. Format is projects/{project}/topics/{topic}.

messagesIEnumerable<PubsubMessage>

Required. The messages to publish.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
topicTopicName

Required. The messages in the request will be published on this topic. Format is projects/{project}/topics/{topic}.

messagesIEnumerable<PubsubMessage>

Required. The messages to publish.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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
NameDescription
topicString

Required. The messages in the request will be published on this topic. Format is projects/{project}/topics/{topic}.

messagesIEnumerable<PubsubMessage>

Required. The messages to publish.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
topicString

Required. The messages in the request will be published on this topic. Format is projects/{project}/topics/{topic}.

messagesIEnumerable<PubsubMessage>

Required. The messages to publish.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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);

SetIamPolicy(IResourceName, Policy, CallSettings)

public virtual Policy SetIamPolicy(IResourceName resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public virtual Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

SetIamPolicy(String, Policy, CallSettings)

public virtual Policy SetIamPolicy(string resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

SetIamPolicyAsync(IResourceName, Policy, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(IResourceName, Policy, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, Policy policy, CancellationToken cancellationToken)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(SetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CancellationToken cancellationToken)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(String, Policy, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(string resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(String, Policy, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(string resource, Policy policy, CancellationToken cancellationToken)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

TestIamPermissions(IResourceName, IEnumerable<String>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

TestIamPermissions(String, IEnumerable<String>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(TestIamPermissionsRequest, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CancellationToken cancellationToken)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(String, IEnumerable<String>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(String, IEnumerable<String>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

UpdateTopic(UpdateTopicRequest, CallSettings)

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

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

Parameters
NameDescription
requestUpdateTopicRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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(UpdateTopicRequest, CallSettings)

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

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

Parameters
NameDescription
requestUpdateTopicRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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. Note that certain properties of a topic are not modifiable.

Parameters
NameDescription
requestUpdateTopicRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<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);