A service to manage comments on cases. v2
Package
@google-cloud/supportConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);Construct an instance of CommentServiceClient.
| Parameters | |
|---|---|
| Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
static get apiEndpoint(): string;The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth: gax.GoogleAuth;commentServiceStub
commentServiceStub?: Promise<{
[name: string]: Function;
}>;descriptors
descriptors: Descriptors;innerApiCalls
innerApiCalls: {
[name: string]: Function;
};pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};port
static get port(): number;The port for this API service.
scopes
static get scopes(): string[];The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;The DNS address for this API service.
warn
warn: (code: string, message: string, warnType?: string) => void;Methods
close()
close(): Promise<void>;Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
| Returns | |
|---|---|
| Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
createComment(request, options)
createComment(request?: protos.google.cloud.support.v2.ICreateCommentRequest, options?: CallOptions): Promise<[
protos.google.cloud.support.v2.IComment,
protos.google.cloud.support.v2.ICreateCommentRequest | undefined,
{} | undefined
]>;Add a new comment to the specified Case. The comment object must have the following fields set: body.
| Parameters | |
|---|---|
| Name | Description |
request |
ICreateCommentRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.support.v2.IComment,
protos.google.cloud.support.v2.ICreateCommentRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Comment. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of Case to which this comment should be added.
*/
// const parent = 'abc123'
/**
* Required. The Comment object to be added to this Case.
*/
// const comment = {}
// Imports the Support library
const {CommentServiceClient} = require('@google-cloud/support').v2;
// Instantiates a client
const supportClient = new CommentServiceClient();
async function callCreateComment() {
// Construct request
const request = {
parent,
comment,
};
// Run request
const response = await supportClient.createComment(request);
console.log(response);
}
callCreateComment();
createComment(request, options, callback)
createComment(request: protos.google.cloud.support.v2.ICreateCommentRequest, options: CallOptions, callback: Callback<protos.google.cloud.support.v2.IComment, protos.google.cloud.support.v2.ICreateCommentRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
ICreateCommentRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.support.v2.IComment, protos.google.cloud.support.v2.ICreateCommentRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
createComment(request, callback)
createComment(request: protos.google.cloud.support.v2.ICreateCommentRequest, callback: Callback<protos.google.cloud.support.v2.IComment, protos.google.cloud.support.v2.ICreateCommentRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
ICreateCommentRequest
|
callback |
Callback<protos.google.cloud.support.v2.IComment, protos.google.cloud.support.v2.ICreateCommentRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
getProjectId()
getProjectId(): Promise<string>;| Returns | |
|---|---|
| Type | Description |
Promise<string> |
|
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;| Parameter | |
|---|---|
| Name | Description |
callback |
Callback<string, undefined, undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
| Returns | |
|---|---|
| Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
listComments(request, options)
listComments(request?: protos.google.cloud.support.v2.IListCommentsRequest, options?: CallOptions): Promise<[
protos.google.cloud.support.v2.IComment[],
protos.google.cloud.support.v2.IListCommentsRequest | null,
protos.google.cloud.support.v2.IListCommentsResponse
]>;Retrieve all Comments associated with the Case object.
| Parameters | |
|---|---|
| Name | Description |
request |
IListCommentsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.support.v2.IComment[],
protos.google.cloud.support.v2.IListCommentsRequest | null,
protos.google.cloud.support.v2.IListCommentsResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of Comment. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listComments(request, options, callback)
listComments(request: protos.google.cloud.support.v2.IListCommentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.support.v2.IListCommentsRequest, protos.google.cloud.support.v2.IListCommentsResponse | null | undefined, protos.google.cloud.support.v2.IComment>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IListCommentsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.support.v2.IListCommentsRequest, protos.google.cloud.support.v2.IListCommentsResponse | null | undefined, protos.google.cloud.support.v2.IComment>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
listComments(request, callback)
listComments(request: protos.google.cloud.support.v2.IListCommentsRequest, callback: PaginationCallback<protos.google.cloud.support.v2.IListCommentsRequest, protos.google.cloud.support.v2.IListCommentsResponse | null | undefined, protos.google.cloud.support.v2.IComment>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IListCommentsRequest
|
callback |
PaginationCallback<protos.google.cloud.support.v2.IListCommentsRequest, protos.google.cloud.support.v2.IListCommentsResponse | null | undefined, protos.google.cloud.support.v2.IComment>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
listCommentsAsync(request, options)
listCommentsAsync(request?: protos.google.cloud.support.v2.IListCommentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.support.v2.IComment>;Equivalent to listComments, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
IListCommentsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<protos.google.cloud.support.v2.IComment> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Comment. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of Case object for which comments should be
* listed.
*/
// const parent = 'abc123'
/**
* The maximum number of comments fetched with each request. Defaults to 10.
*/
// const pageSize = 1234
/**
* A token identifying the page of results to return. If unspecified, the
* first page is retrieved.
*/
// const pageToken = 'abc123'
// Imports the Support library
const {CommentServiceClient} = require('@google-cloud/support').v2;
// Instantiates a client
const supportClient = new CommentServiceClient();
async function callListComments() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = await supportClient.listCommentsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListComments();
listCommentsStream(request, options)
listCommentsStream(request?: protos.google.cloud.support.v2.IListCommentsRequest, options?: CallOptions): Transform;Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.
| Parameters | |
|---|---|
| Name | Description |
request |
IListCommentsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Transform |
{Stream} An object stream which emits an object representing Comment on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
matchAttachmentIdFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)
matchAttachmentIdFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName: string): string | number;Parse the attachment_id from OrganizationCaseAttachmentId resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseAttachmentIdName |
string
A fully-qualified path representing organization_case_attachment_id resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the attachment_id. |
matchAttachmentIdFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)
matchAttachmentIdFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName: string): string | number;Parse the attachment_id from ProjectCaseAttachmentId resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseAttachmentIdName |
string
A fully-qualified path representing project_case_attachment_id resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the attachment_id. |
matchCaseFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)
matchCaseFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName: string): string | number;Parse the case from OrganizationCaseAttachmentId resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseAttachmentIdName |
string
A fully-qualified path representing organization_case_attachment_id resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the case. |
matchCaseFromOrganizationCaseCommentName(organizationCaseCommentName)
matchCaseFromOrganizationCaseCommentName(organizationCaseCommentName: string): string | number;Parse the case from OrganizationCaseComment resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseCommentName |
string
A fully-qualified path representing organization_case_comment resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the case. |
matchCaseFromOrganizationCaseName(organizationCaseName)
matchCaseFromOrganizationCaseName(organizationCaseName: string): string | number;Parse the case from OrganizationCase resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseName |
string
A fully-qualified path representing organization_case resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the case. |
matchCaseFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)
matchCaseFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName: string): string | number;Parse the case from ProjectCaseAttachmentId resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseAttachmentIdName |
string
A fully-qualified path representing project_case_attachment_id resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the case. |
matchCaseFromProjectCaseCommentName(projectCaseCommentName)
matchCaseFromProjectCaseCommentName(projectCaseCommentName: string): string | number;Parse the case from ProjectCaseComment resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseCommentName |
string
A fully-qualified path representing project_case_comment resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the case. |
matchCaseFromProjectCaseName(projectCaseName)
matchCaseFromProjectCaseName(projectCaseName: string): string | number;Parse the case from ProjectCase resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseName |
string
A fully-qualified path representing project_case resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the case. |
matchCommentFromOrganizationCaseCommentName(organizationCaseCommentName)
matchCommentFromOrganizationCaseCommentName(organizationCaseCommentName: string): string | number;Parse the comment from OrganizationCaseComment resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseCommentName |
string
A fully-qualified path representing organization_case_comment resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the comment. |
matchCommentFromProjectCaseCommentName(projectCaseCommentName)
matchCommentFromProjectCaseCommentName(projectCaseCommentName: string): string | number;Parse the comment from ProjectCaseComment resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseCommentName |
string
A fully-qualified path representing project_case_comment resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the comment. |
matchOrganizationFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)
matchOrganizationFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName: string): string | number;Parse the organization from OrganizationCaseAttachmentId resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseAttachmentIdName |
string
A fully-qualified path representing organization_case_attachment_id resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the organization. |
matchOrganizationFromOrganizationCaseCommentName(organizationCaseCommentName)
matchOrganizationFromOrganizationCaseCommentName(organizationCaseCommentName: string): string | number;Parse the organization from OrganizationCaseComment resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseCommentName |
string
A fully-qualified path representing organization_case_comment resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the organization. |
matchOrganizationFromOrganizationCaseName(organizationCaseName)
matchOrganizationFromOrganizationCaseName(organizationCaseName: string): string | number;Parse the organization from OrganizationCase resource.
| Parameter | |
|---|---|
| Name | Description |
organizationCaseName |
string
A fully-qualified path representing organization_case resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the organization. |
matchProjectFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)
matchProjectFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName: string): string | number;Parse the project from ProjectCaseAttachmentId resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseAttachmentIdName |
string
A fully-qualified path representing project_case_attachment_id resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromProjectCaseCommentName(projectCaseCommentName)
matchProjectFromProjectCaseCommentName(projectCaseCommentName: string): string | number;Parse the project from ProjectCaseComment resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseCommentName |
string
A fully-qualified path representing project_case_comment resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromProjectCaseName(projectCaseName)
matchProjectFromProjectCaseName(projectCaseName: string): string | number;Parse the project from ProjectCase resource.
| Parameter | |
|---|---|
| Name | Description |
projectCaseName |
string
A fully-qualified path representing project_case resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
organizationCaseAttachmentIdPath(organization, caseParam, attachmentId)
organizationCaseAttachmentIdPath(organization: string, caseParam: string, attachmentId: string): string;Return a fully-qualified organizationCaseAttachmentId resource name string.
| Parameters | |
|---|---|
| Name | Description |
organization |
string
|
caseParam |
string
|
attachmentId |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
organizationCaseCommentPath(organization, caseParam, comment)
organizationCaseCommentPath(organization: string, caseParam: string, comment: string): string;Return a fully-qualified organizationCaseComment resource name string.
| Parameters | |
|---|---|
| Name | Description |
organization |
string
|
caseParam |
string
|
comment |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
organizationCasePath(organization, caseParam)
organizationCasePath(organization: string, caseParam: string): string;Return a fully-qualified organizationCase resource name string.
| Parameters | |
|---|---|
| Name | Description |
organization |
string
|
caseParam |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
projectCaseAttachmentIdPath(project, caseParam, attachmentId)
projectCaseAttachmentIdPath(project: string, caseParam: string, attachmentId: string): string;Return a fully-qualified projectCaseAttachmentId resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
caseParam |
string
|
attachmentId |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
projectCaseCommentPath(project, caseParam, comment)
projectCaseCommentPath(project: string, caseParam: string, comment: string): string;Return a fully-qualified projectCaseComment resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
caseParam |
string
|
comment |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
projectCasePath(project, caseParam)
projectCasePath(project: string, caseParam: string): string;Return a fully-qualified projectCase resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
caseParam |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |