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.
opts
ClientOptions
gaxInstance
typeof gax
| typeof fallback
: loaded instance of google-gax
. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new CommentServiceClient({fallback: true}, gax); ```
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.
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.
request
options
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
;
request
options
CallOptions
callback
Callback
< protos.google.cloud.support.v2.IComment
, protos.google.cloud.support.v2.ICreateCommentRequest
| null | undefined, {} | null | undefined>
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
;
request
callback
Callback
< protos.google.cloud.support.v2.IComment
, protos.google.cloud.support.v2.ICreateCommentRequest
| null | undefined, {} | null | undefined>
void
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, undefined>
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.
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.
request
options
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 listCommentsAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
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
;
request
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
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
;
request
callback
PaginationCallback
< protos.google.cloud.support.v2.IListCommentsRequest
, protos.google.cloud.support.v2.IListCommentsResponse
| null | undefined, protos.google.cloud.support.v2.IComment
>
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.
request
options
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.
request
options
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 listCommentsAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
matchAttachmentIdFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)
matchAttachmentIdFromOrganizationCaseAttachmentIdName
(
organizationCaseAttachmentIdName
:
string
)
:
string
|
number
;
Parse the attachment_id from OrganizationCaseAttachmentId resource.
organizationCaseAttachmentIdName
string
A fully-qualified path representing organization_case_attachment_id resource.
string | number
{string} A string representing the attachment_id.
matchAttachmentIdFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)
matchAttachmentIdFromProjectCaseAttachmentIdName
(
projectCaseAttachmentIdName
:
string
)
:
string
|
number
;
Parse the attachment_id from ProjectCaseAttachmentId resource.
projectCaseAttachmentIdName
string
A fully-qualified path representing project_case_attachment_id resource.
string | number
{string} A string representing the attachment_id.
matchCaseFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)
matchCaseFromOrganizationCaseAttachmentIdName
(
organizationCaseAttachmentIdName
:
string
)
:
string
|
number
;
Parse the case from OrganizationCaseAttachmentId resource.
organizationCaseAttachmentIdName
string
A fully-qualified path representing organization_case_attachment_id resource.
string | number
{string} A string representing the case.
matchCaseFromOrganizationCaseCommentName(organizationCaseCommentName)
matchCaseFromOrganizationCaseCommentName
(
organizationCaseCommentName
:
string
)
:
string
|
number
;
Parse the case from OrganizationCaseComment resource.
organizationCaseCommentName
string
A fully-qualified path representing organization_case_comment resource.
string | number
{string} A string representing the case.
matchCaseFromOrganizationCaseName(organizationCaseName)
matchCaseFromOrganizationCaseName
(
organizationCaseName
:
string
)
:
string
|
number
;
Parse the case from OrganizationCase resource.
organizationCaseName
string
A fully-qualified path representing organization_case resource.
string | number
{string} A string representing the case.
matchCaseFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)
matchCaseFromProjectCaseAttachmentIdName
(
projectCaseAttachmentIdName
:
string
)
:
string
|
number
;
Parse the case from ProjectCaseAttachmentId resource.
projectCaseAttachmentIdName
string
A fully-qualified path representing project_case_attachment_id resource.
string | number
{string} A string representing the case.
matchCaseFromProjectCaseCommentName(projectCaseCommentName)
matchCaseFromProjectCaseCommentName
(
projectCaseCommentName
:
string
)
:
string
|
number
;
Parse the case from ProjectCaseComment resource.
projectCaseCommentName
string
A fully-qualified path representing project_case_comment resource.
string | number
{string} A string representing the case.
matchCaseFromProjectCaseName(projectCaseName)
matchCaseFromProjectCaseName
(
projectCaseName
:
string
)
:
string
|
number
;
Parse the case from ProjectCase resource.
projectCaseName
string
A fully-qualified path representing project_case resource.
string | number
{string} A string representing the case.
matchCommentFromOrganizationCaseCommentName(organizationCaseCommentName)
matchCommentFromOrganizationCaseCommentName
(
organizationCaseCommentName
:
string
)
:
string
|
number
;
Parse the comment from OrganizationCaseComment resource.
organizationCaseCommentName
string
A fully-qualified path representing organization_case_comment resource.
string | number
{string} A string representing the comment.
matchCommentFromProjectCaseCommentName(projectCaseCommentName)
matchCommentFromProjectCaseCommentName
(
projectCaseCommentName
:
string
)
:
string
|
number
;
Parse the comment from ProjectCaseComment resource.
projectCaseCommentName
string
A fully-qualified path representing project_case_comment resource.
string | number
{string} A string representing the comment.
matchOrganizationFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)
matchOrganizationFromOrganizationCaseAttachmentIdName
(
organizationCaseAttachmentIdName
:
string
)
:
string
|
number
;
Parse the organization from OrganizationCaseAttachmentId resource.
organizationCaseAttachmentIdName
string
A fully-qualified path representing organization_case_attachment_id resource.
string | number
{string} A string representing the organization.
matchOrganizationFromOrganizationCaseCommentName(organizationCaseCommentName)
matchOrganizationFromOrganizationCaseCommentName
(
organizationCaseCommentName
:
string
)
:
string
|
number
;
Parse the organization from OrganizationCaseComment resource.
organizationCaseCommentName
string
A fully-qualified path representing organization_case_comment resource.
string | number
{string} A string representing the organization.
matchOrganizationFromOrganizationCaseName(organizationCaseName)
matchOrganizationFromOrganizationCaseName
(
organizationCaseName
:
string
)
:
string
|
number
;
Parse the organization from OrganizationCase resource.
organizationCaseName
string
A fully-qualified path representing organization_case resource.
string | number
{string} A string representing the organization.
matchProjectFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)
matchProjectFromProjectCaseAttachmentIdName
(
projectCaseAttachmentIdName
:
string
)
:
string
|
number
;
Parse the project from ProjectCaseAttachmentId resource.
projectCaseAttachmentIdName
string
A fully-qualified path representing project_case_attachment_id resource.
string | number
{string} A string representing the project.
matchProjectFromProjectCaseCommentName(projectCaseCommentName)
matchProjectFromProjectCaseCommentName
(
projectCaseCommentName
:
string
)
:
string
|
number
;
Parse the project from ProjectCaseComment resource.
projectCaseCommentName
string
A fully-qualified path representing project_case_comment resource.
string | number
{string} A string representing the project.
matchProjectFromProjectCaseName(projectCaseName)
matchProjectFromProjectCaseName
(
projectCaseName
:
string
)
:
string
|
number
;
Parse the project from ProjectCase resource.
projectCaseName
string
A fully-qualified path representing project_case resource.
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.
organization
string
caseParam
string
attachmentId
string
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.
organization
string
caseParam
string
comment
string
string
{string} Resource name string.
organizationCasePath(organization, caseParam)
organizationCasePath
(
organization
:
string
,
caseParam
:
string
)
:
string
;
Return a fully-qualified organizationCase resource name string.
organization
string
caseParam
string
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.
project
string
caseParam
string
attachmentId
string
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.
project
string
caseParam
string
comment
string
string
{string} Resource name string.
projectCasePath(project, caseParam)
projectCasePath
(
project
:
string
,
caseParam
:
string
)
:
string
;
Return a fully-qualified projectCase resource name string.
project
string
caseParam
string
string
{string} Resource name string.