Class v2.CaseAttachmentServiceClient (1.0.2)

A service to manage file attachment for Google Cloud support cases. v2

Package

@google-cloud/support

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of CaseAttachmentServiceClient.

Parameters
NameDescription
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 CaseAttachmentServiceClient({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;

caseAttachmentServiceStub

caseAttachmentServiceStub?: 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
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
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
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listAttachments(request, options)

listAttachments(request?: protos.google.cloud.support.v2.IListAttachmentsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.support.v2.IAttachment[],
        protos.google.cloud.support.v2.IListAttachmentsRequest | null,
        protos.google.cloud.support.v2.IListAttachmentsResponse
    ]>;

Retrieve all attachments associated with a support case.

Parameters
NameDescription
request IListAttachmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.support.v2.IAttachment[], protos.google.cloud.support.v2.IListAttachmentsRequest | null, protos.google.cloud.support.v2.IListAttachmentsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Attachment. 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 listAttachmentsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAttachments(request, options, callback)

listAttachments(request: protos.google.cloud.support.v2.IListAttachmentsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.support.v2.IListAttachmentsRequest, protos.google.cloud.support.v2.IListAttachmentsResponse | null | undefined, protos.google.cloud.support.v2.IAttachment>): void;
Parameters
NameDescription
request IListAttachmentsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.support.v2.IListAttachmentsRequest, protos.google.cloud.support.v2.IListAttachmentsResponse | null | undefined, protos.google.cloud.support.v2.IAttachment>
Returns
TypeDescription
void

listAttachments(request, callback)

listAttachments(request: protos.google.cloud.support.v2.IListAttachmentsRequest, callback: PaginationCallback<protos.google.cloud.support.v2.IListAttachmentsRequest, protos.google.cloud.support.v2.IListAttachmentsResponse | null | undefined, protos.google.cloud.support.v2.IAttachment>): void;
Parameters
NameDescription
request IListAttachmentsRequest
callback PaginationCallback<protos.google.cloud.support.v2.IListAttachmentsRequest, protos.google.cloud.support.v2.IListAttachmentsResponse | null | undefined, protos.google.cloud.support.v2.IAttachment>
Returns
TypeDescription
void

listAttachmentsAsync(request, options)

listAttachmentsAsync(request?: protos.google.cloud.support.v2.IListAttachmentsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.support.v2.IAttachment>;

Equivalent to listAttachments, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request IListAttachmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.support.v2.IAttachment>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Attachment. 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.

Example

  /**
   * 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 attachments should be
   *  listed.
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of attachments fetched with each request. If not
   *  provided, the default is 10. The maximum page size that will be returned is
   *  100.
   */
  // 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 {CaseAttachmentServiceClient} = require('@google-cloud/support').v2;

  // Instantiates a client
  const supportClient = new CaseAttachmentServiceClient();

  async function callListAttachments() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await supportClient.listAttachmentsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListAttachments();

listAttachmentsStream(request, options)

listAttachmentsStream(request?: protos.google.cloud.support.v2.IListAttachmentsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request IListAttachmentsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing Attachment 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 listAttachmentsAsync() 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.

Parameter
NameDescription
organizationCaseAttachmentIdName string

A fully-qualified path representing organization_case_attachment_id resource.

Returns
TypeDescription
string | number

{string} A string representing the attachment_id.

matchAttachmentIdFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)

matchAttachmentIdFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName: string): string | number;

Parse the attachment_id from ProjectCaseAttachmentId resource.

Parameter
NameDescription
projectCaseAttachmentIdName string

A fully-qualified path representing project_case_attachment_id resource.

Returns
TypeDescription
string | number

{string} A string representing the attachment_id.

matchCaseFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)

matchCaseFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName: string): string | number;

Parse the case from OrganizationCaseAttachmentId resource.

Parameter
NameDescription
organizationCaseAttachmentIdName string

A fully-qualified path representing organization_case_attachment_id resource.

Returns
TypeDescription
string | number

{string} A string representing the case.

matchCaseFromOrganizationCaseCommentName(organizationCaseCommentName)

matchCaseFromOrganizationCaseCommentName(organizationCaseCommentName: string): string | number;

Parse the case from OrganizationCaseComment resource.

Parameter
NameDescription
organizationCaseCommentName string

A fully-qualified path representing organization_case_comment resource.

Returns
TypeDescription
string | number

{string} A string representing the case.

matchCaseFromOrganizationCaseName(organizationCaseName)

matchCaseFromOrganizationCaseName(organizationCaseName: string): string | number;

Parse the case from OrganizationCase resource.

Parameter
NameDescription
organizationCaseName string

A fully-qualified path representing organization_case resource.

Returns
TypeDescription
string | number

{string} A string representing the case.

matchCaseFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)

matchCaseFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName: string): string | number;

Parse the case from ProjectCaseAttachmentId resource.

Parameter
NameDescription
projectCaseAttachmentIdName string

A fully-qualified path representing project_case_attachment_id resource.

Returns
TypeDescription
string | number

{string} A string representing the case.

matchCaseFromProjectCaseCommentName(projectCaseCommentName)

matchCaseFromProjectCaseCommentName(projectCaseCommentName: string): string | number;

Parse the case from ProjectCaseComment resource.

Parameter
NameDescription
projectCaseCommentName string

A fully-qualified path representing project_case_comment resource.

Returns
TypeDescription
string | number

{string} A string representing the case.

matchCaseFromProjectCaseName(projectCaseName)

matchCaseFromProjectCaseName(projectCaseName: string): string | number;

Parse the case from ProjectCase resource.

Parameter
NameDescription
projectCaseName string

A fully-qualified path representing project_case resource.

Returns
TypeDescription
string | number

{string} A string representing the case.

matchCommentFromOrganizationCaseCommentName(organizationCaseCommentName)

matchCommentFromOrganizationCaseCommentName(organizationCaseCommentName: string): string | number;

Parse the comment from OrganizationCaseComment resource.

Parameter
NameDescription
organizationCaseCommentName string

A fully-qualified path representing organization_case_comment resource.

Returns
TypeDescription
string | number

{string} A string representing the comment.

matchCommentFromProjectCaseCommentName(projectCaseCommentName)

matchCommentFromProjectCaseCommentName(projectCaseCommentName: string): string | number;

Parse the comment from ProjectCaseComment resource.

Parameter
NameDescription
projectCaseCommentName string

A fully-qualified path representing project_case_comment resource.

Returns
TypeDescription
string | number

{string} A string representing the comment.

matchOrganizationFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName)

matchOrganizationFromOrganizationCaseAttachmentIdName(organizationCaseAttachmentIdName: string): string | number;

Parse the organization from OrganizationCaseAttachmentId resource.

Parameter
NameDescription
organizationCaseAttachmentIdName string

A fully-qualified path representing organization_case_attachment_id resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchOrganizationFromOrganizationCaseCommentName(organizationCaseCommentName)

matchOrganizationFromOrganizationCaseCommentName(organizationCaseCommentName: string): string | number;

Parse the organization from OrganizationCaseComment resource.

Parameter
NameDescription
organizationCaseCommentName string

A fully-qualified path representing organization_case_comment resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchOrganizationFromOrganizationCaseName(organizationCaseName)

matchOrganizationFromOrganizationCaseName(organizationCaseName: string): string | number;

Parse the organization from OrganizationCase resource.

Parameter
NameDescription
organizationCaseName string

A fully-qualified path representing organization_case resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchProjectFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName)

matchProjectFromProjectCaseAttachmentIdName(projectCaseAttachmentIdName: string): string | number;

Parse the project from ProjectCaseAttachmentId resource.

Parameter
NameDescription
projectCaseAttachmentIdName string

A fully-qualified path representing project_case_attachment_id resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectCaseCommentName(projectCaseCommentName)

matchProjectFromProjectCaseCommentName(projectCaseCommentName: string): string | number;

Parse the project from ProjectCaseComment resource.

Parameter
NameDescription
projectCaseCommentName string

A fully-qualified path representing project_case_comment resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectCaseName(projectCaseName)

matchProjectFromProjectCaseName(projectCaseName: string): string | number;

Parse the project from ProjectCase resource.

Parameter
NameDescription
projectCaseName string

A fully-qualified path representing project_case resource.

Returns
TypeDescription
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
NameDescription
organization string
caseParam string
attachmentId string
Returns
TypeDescription
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
NameDescription
organization string
caseParam string
comment string
Returns
TypeDescription
string

{string} Resource name string.

organizationCasePath(organization, caseParam)

organizationCasePath(organization: string, caseParam: string): string;

Return a fully-qualified organizationCase resource name string.

Parameters
NameDescription
organization string
caseParam string
Returns
TypeDescription
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
NameDescription
project string
caseParam string
attachmentId string
Returns
TypeDescription
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
NameDescription
project string
caseParam string
comment string
Returns
TypeDescription
string

{string} Resource name string.

projectCasePath(project, caseParam)

projectCasePath(project: string, caseParam: string): string;

Return a fully-qualified projectCase resource name string.

Parameters
NameDescription
project string
caseParam string
Returns
TypeDescription
string

{string} Resource name string.