Google Cloud Support v2 API - Class CommentServiceClient (1.0.0)

public abstract class CommentServiceClient

Reference documentation and code samples for the Google Cloud Support v2 API class CommentServiceClient.

CommentService client wrapper, for convenient use.

Inheritance

object > CommentServiceClient

Derived Types

Namespace

Google.Cloud.Support.V2

Assembly

Google.Cloud.Support.V2.dll

Remarks

A service to manage comments on cases.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default CommentService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default CommentService scopes are:

GrpcClient

public virtual CommentService.CommentServiceClient GrpcClient { get; }

The underlying gRPC CommentService client

Property Value
TypeDescription
CommentServiceCommentServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static CommentServiceClient Create()

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

Returns
TypeDescription
CommentServiceClient

The created CommentServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskCommentServiceClient

The task representing the created CommentServiceClient.

CreateComment(CaseName, Comment, CallSettings)

public virtual Comment CreateComment(CaseName parent, Comment comment, CallSettings callSettings = null)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
parentCaseName

Required. The resource name of Case to which this comment should be added.

commentComment

Required. The Comment object to be added to this Case.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Comment

The RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = CommentServiceClient.Create();
// Initialize request argument(s)
CaseName parent = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]");
Comment comment = new Comment();
// Make the request
Comment response = commentServiceClient.CreateComment(parent, comment);

CreateComment(CreateCommentRequest, CallSettings)

public virtual Comment CreateComment(CreateCommentRequest request, CallSettings callSettings = null)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
requestCreateCommentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Comment

The RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = CommentServiceClient.Create();
// Initialize request argument(s)
CreateCommentRequest request = new CreateCommentRequest
{
    ParentAsCaseName = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]"),
    Comment = new Comment(),
};
// Make the request
Comment response = commentServiceClient.CreateComment(request);

CreateComment(string, Comment, CallSettings)

public virtual Comment CreateComment(string parent, Comment comment, CallSettings callSettings = null)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
parentstring

Required. The resource name of Case to which this comment should be added.

commentComment

Required. The Comment object to be added to this Case.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Comment

The RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = CommentServiceClient.Create();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/cases/[CASE]";
Comment comment = new Comment();
// Make the request
Comment response = commentServiceClient.CreateComment(parent, comment);

CreateCommentAsync(CaseName, Comment, CallSettings)

public virtual Task<Comment> CreateCommentAsync(CaseName parent, Comment comment, CallSettings callSettings = null)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
parentCaseName

Required. The resource name of Case to which this comment should be added.

commentComment

Required. The Comment object to be added to this Case.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskComment

A Task containing the RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
CaseName parent = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]");
Comment comment = new Comment();
// Make the request
Comment response = await commentServiceClient.CreateCommentAsync(parent, comment);

CreateCommentAsync(CaseName, Comment, CancellationToken)

public virtual Task<Comment> CreateCommentAsync(CaseName parent, Comment comment, CancellationToken cancellationToken)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
parentCaseName

Required. The resource name of Case to which this comment should be added.

commentComment

Required. The Comment object to be added to this Case.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskComment

A Task containing the RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
CaseName parent = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]");
Comment comment = new Comment();
// Make the request
Comment response = await commentServiceClient.CreateCommentAsync(parent, comment);

CreateCommentAsync(CreateCommentRequest, CallSettings)

public virtual Task<Comment> CreateCommentAsync(CreateCommentRequest request, CallSettings callSettings = null)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
requestCreateCommentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskComment

A Task containing the RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCommentRequest request = new CreateCommentRequest
{
    ParentAsCaseName = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]"),
    Comment = new Comment(),
};
// Make the request
Comment response = await commentServiceClient.CreateCommentAsync(request);

CreateCommentAsync(CreateCommentRequest, CancellationToken)

public virtual Task<Comment> CreateCommentAsync(CreateCommentRequest request, CancellationToken cancellationToken)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
requestCreateCommentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskComment

A Task containing the RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCommentRequest request = new CreateCommentRequest
{
    ParentAsCaseName = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]"),
    Comment = new Comment(),
};
// Make the request
Comment response = await commentServiceClient.CreateCommentAsync(request);

CreateCommentAsync(string, Comment, CallSettings)

public virtual Task<Comment> CreateCommentAsync(string parent, Comment comment, CallSettings callSettings = null)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
parentstring

Required. The resource name of Case to which this comment should be added.

commentComment

Required. The Comment object to be added to this Case.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskComment

A Task containing the RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/cases/[CASE]";
Comment comment = new Comment();
// Make the request
Comment response = await commentServiceClient.CreateCommentAsync(parent, comment);

CreateCommentAsync(string, Comment, CancellationToken)

public virtual Task<Comment> CreateCommentAsync(string parent, Comment comment, CancellationToken cancellationToken)

Add a new comment to the specified Case. The comment object must have the following fields set: body.

Parameters
NameDescription
parentstring

Required. The resource name of Case to which this comment should be added.

commentComment

Required. The Comment object to be added to this Case.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskComment

A Task containing the RPC response.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/cases/[CASE]";
Comment comment = new Comment();
// Make the request
Comment response = await commentServiceClient.CreateCommentAsync(parent, comment);

ListComments(CaseName, string, int?, CallSettings)

public virtual PagedEnumerable<ListCommentsResponse, Comment> ListComments(CaseName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all Comments associated with the Case object.

Parameters
NameDescription
parentCaseName

Required. The resource name of Case object for which comments should be listed.

pageTokenstring

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

pageSizeint

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
PagedEnumerableListCommentsResponseComment

A pageable sequence of Comment resources.

Example
// Create client
CommentServiceClient commentServiceClient = CommentServiceClient.Create();
// Initialize request argument(s)
CaseName parent = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]");
// Make the request
PagedEnumerable<ListCommentsResponse, Comment> response = commentServiceClient.ListComments(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Comment 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 (ListCommentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Comment 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<Comment> 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 (Comment 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;

ListComments(ListCommentsRequest, CallSettings)

public virtual PagedEnumerable<ListCommentsResponse, Comment> ListComments(ListCommentsRequest request, CallSettings callSettings = null)

Retrieve all Comments associated with the Case object.

Parameters
NameDescription
requestListCommentsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListCommentsResponseComment

A pageable sequence of Comment resources.

Example
// Create client
CommentServiceClient commentServiceClient = CommentServiceClient.Create();
// Initialize request argument(s)
ListCommentsRequest request = new ListCommentsRequest
{
    ParentAsCaseName = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]"),
};
// Make the request
PagedEnumerable<ListCommentsResponse, Comment> response = commentServiceClient.ListComments(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Comment 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 (ListCommentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Comment 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<Comment> 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 (Comment 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;

ListComments(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListCommentsResponse, Comment> ListComments(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all Comments associated with the Case object.

Parameters
NameDescription
parentstring

Required. The resource name of Case object for which comments should be listed.

pageTokenstring

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

pageSizeint

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
PagedEnumerableListCommentsResponseComment

A pageable sequence of Comment resources.

Example
// Create client
CommentServiceClient commentServiceClient = CommentServiceClient.Create();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/cases/[CASE]";
// Make the request
PagedEnumerable<ListCommentsResponse, Comment> response = commentServiceClient.ListComments(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Comment 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 (ListCommentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Comment 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<Comment> 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 (Comment 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;

ListCommentsAsync(CaseName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCommentsResponse, Comment> ListCommentsAsync(CaseName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all Comments associated with the Case object.

Parameters
NameDescription
parentCaseName

Required. The resource name of Case object for which comments should be listed.

pageTokenstring

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

pageSizeint

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
PagedAsyncEnumerableListCommentsResponseComment

A pageable asynchronous sequence of Comment resources.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
CaseName parent = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]");
// Make the request
PagedAsyncEnumerable<ListCommentsResponse, Comment> response = commentServiceClient.ListCommentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Comment 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((ListCommentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Comment 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<Comment> 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 (Comment 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;

ListCommentsAsync(ListCommentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListCommentsResponse, Comment> ListCommentsAsync(ListCommentsRequest request, CallSettings callSettings = null)

Retrieve all Comments associated with the Case object.

Parameters
NameDescription
requestListCommentsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListCommentsResponseComment

A pageable asynchronous sequence of Comment resources.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
ListCommentsRequest request = new ListCommentsRequest
{
    ParentAsCaseName = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]"),
};
// Make the request
PagedAsyncEnumerable<ListCommentsResponse, Comment> response = commentServiceClient.ListCommentsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Comment 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((ListCommentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Comment 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<Comment> 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 (Comment 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;

ListCommentsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCommentsResponse, Comment> ListCommentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all Comments associated with the Case object.

Parameters
NameDescription
parentstring

Required. The resource name of Case object for which comments should be listed.

pageTokenstring

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

pageSizeint

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
PagedAsyncEnumerableListCommentsResponseComment

A pageable asynchronous sequence of Comment resources.

Example
// Create client
CommentServiceClient commentServiceClient = await CommentServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/cases/[CASE]";
// Make the request
PagedAsyncEnumerable<ListCommentsResponse, Comment> response = commentServiceClient.ListCommentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Comment 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((ListCommentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Comment 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<Comment> 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 (Comment 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;

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.