Class v1.EssentialContactsServiceClient (2.1.2)

Manages contacts for important Google Cloud notifications. v1

Package

@google-cloud/essential-contacts

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of EssentialContactsServiceClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof gax.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 EssentialContactsServiceClient({fallback: 'rest'}, 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;

descriptors

descriptors: Descriptors;

essentialContactsServiceStub

essentialContactsServiceStub?: Promise<{
        [name: string]: Function;
    }>;

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.

computeContacts(request, options)

computeContacts(request?: protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.essentialcontacts.v1.IContact[],
        protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest | null,
        protos.google.cloud.essentialcontacts.v1.IComputeContactsResponse
    ]>;

Lists all contacts for the resource that are subscribed to the specified notification categories, including contacts inherited from any parent resources.

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.essentialcontacts.v1.IContact[], protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest | null, protos.google.cloud.essentialcontacts.v1.IComputeContactsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 computeContactsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

computeContacts(request, options, callback)

computeContacts(request: protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, protos.google.cloud.essentialcontacts.v1.IComputeContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, protos.google.cloud.essentialcontacts.v1.IComputeContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>
Returns
TypeDescription
void

computeContacts(request, callback)

computeContacts(request: protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, callback: PaginationCallback<protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, protos.google.cloud.essentialcontacts.v1.IComputeContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest
callback PaginationCallback<protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, protos.google.cloud.essentialcontacts.v1.IComputeContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>
Returns
TypeDescription
void

computeContactsAsync(request, options)

computeContactsAsync(request?: protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.essentialcontacts.v1.IContact>;

Equivalent to computeContacts, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.essentialcontacts.v1.IContact>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) 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 name of the resource to compute contacts for.
   *  Format: organizations/{organization_id},
   *  folders/{folder_id} or projects/{project_id}
   */
  // const parent = 'abc123'
  /**
   *  The categories of notifications to compute contacts for. If ALL is included
   *  in this list, contacts subscribed to any notification category will be
   *  returned.
   */
  // const notificationCategories = 1234
  /**
   *  Optional. The maximum number of results to return from this request.
   *  Non-positive values are ignored. The presence of `next_page_token` in the
   *  response indicates that more results might be available.
   *  If not specified, the default page_size is 100.
   */
  // const pageSize = 1234
  /**
   *  Optional. If present, retrieves the next batch of results from the
   *  preceding call to this method. `page_token` must be the value of
   *  `next_page_token` from the previous response. The values of other method
   *  parameters should be identical to those in the previous call.
   */
  // const pageToken = 'abc123'

  // Imports the Essentialcontacts library
  const {EssentialContactsServiceClient} = require('@google-cloud/essential-contacts').v1;

  // Instantiates a client
  const essentialcontactsClient = new EssentialContactsServiceClient();

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

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

  callComputeContacts();

computeContactsStream(request, options)

computeContactsStream(request?: protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IComputeContactsRequest

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 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 computeContactsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

createContact(request, options)

createContact(request?: protos.google.cloud.essentialcontacts.v1.ICreateContactRequest, options?: CallOptions): Promise<[
        protos.google.cloud.essentialcontacts.v1.IContact,
        (protos.google.cloud.essentialcontacts.v1.ICreateContactRequest | undefined),
        {} | undefined
    ]>;

Adds a new contact for a resource.

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.ICreateContactRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.essentialcontacts.v1.IContact, (protos.google.cloud.essentialcontacts.v1.ICreateContactRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 to save this contact for.
   *  Format: organizations/{organization_id}, folders/{folder_id} or
   *  projects/{project_id}
   */
  // const parent = 'abc123'
  /**
   *  Required. The contact to create. Must specify an email address and language
   *  tag.
   */
  // const contact = {}

  // Imports the Essentialcontacts library
  const {EssentialContactsServiceClient} = require('@google-cloud/essential-contacts').v1;

  // Instantiates a client
  const essentialcontactsClient = new EssentialContactsServiceClient();

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

    // Run request
    const response = await essentialcontactsClient.createContact(request);
    console.log(response);
  }

  callCreateContact();

createContact(request, options, callback)

createContact(request: protos.google.cloud.essentialcontacts.v1.ICreateContactRequest, options: CallOptions, callback: Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.ICreateContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.ICreateContactRequest
options CallOptions
callback Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.ICreateContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createContact(request, callback)

createContact(request: protos.google.cloud.essentialcontacts.v1.ICreateContactRequest, callback: Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.ICreateContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.ICreateContactRequest
callback Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.ICreateContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteContact(request, options)

deleteContact(request?: protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest | undefined),
        {} | undefined
    ]>;

Deletes a contact.

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 name of the contact to delete.
   *  Format: organizations/{organization_id}/contacts/{contact_id},
   *  folders/{folder_id}/contacts/{contact_id} or
   *  projects/{project_id}/contacts/{contact_id}
   */
  // const name = 'abc123'

  // Imports the Essentialcontacts library
  const {EssentialContactsServiceClient} = require('@google-cloud/essential-contacts').v1;

  // Instantiates a client
  const essentialcontactsClient = new EssentialContactsServiceClient();

  async function callDeleteContact() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await essentialcontactsClient.deleteContact(request);
    console.log(response);
  }

  callDeleteContact();

deleteContact(request, options, callback)

deleteContact(request: protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteContact(request, callback)

deleteContact(request: protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.IDeleteContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

folderContactPath(folder, contact)

folderContactPath(folder: string, contact: string): string;

Return a fully-qualified folderContact resource name string.

Parameters
NameDescription
folder string
contact string
Returns
TypeDescription
string

{string} Resource name string.

getContact(request, options)

getContact(request?: protos.google.cloud.essentialcontacts.v1.IGetContactRequest, options?: CallOptions): Promise<[
        protos.google.cloud.essentialcontacts.v1.IContact,
        protos.google.cloud.essentialcontacts.v1.IGetContactRequest | undefined,
        {} | undefined
    ]>;

Gets a single contact.

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IGetContactRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IGetContactRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 name of the contact to retrieve.
   *  Format: organizations/{organization_id}/contacts/{contact_id},
   *  folders/{folder_id}/contacts/{contact_id} or
   *  projects/{project_id}/contacts/{contact_id}
   */
  // const name = 'abc123'

  // Imports the Essentialcontacts library
  const {EssentialContactsServiceClient} = require('@google-cloud/essential-contacts').v1;

  // Instantiates a client
  const essentialcontactsClient = new EssentialContactsServiceClient();

  async function callGetContact() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await essentialcontactsClient.getContact(request);
    console.log(response);
  }

  callGetContact();

getContact(request, options, callback)

getContact(request: protos.google.cloud.essentialcontacts.v1.IGetContactRequest, options: CallOptions, callback: Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IGetContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IGetContactRequest
options CallOptions
callback Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IGetContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getContact(request, callback)

getContact(request: protos.google.cloud.essentialcontacts.v1.IGetContactRequest, callback: Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IGetContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IGetContactRequest
callback Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IGetContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

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.

listContacts(request, options)

listContacts(request?: protos.google.cloud.essentialcontacts.v1.IListContactsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.essentialcontacts.v1.IContact[],
        protos.google.cloud.essentialcontacts.v1.IListContactsRequest | null,
        protos.google.cloud.essentialcontacts.v1.IListContactsResponse
    ]>;

Lists the contacts that have been set on a resource.

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IListContactsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.essentialcontacts.v1.IContact[], protos.google.cloud.essentialcontacts.v1.IListContactsRequest | null, protos.google.cloud.essentialcontacts.v1.IListContactsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 listContactsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listContacts(request, options, callback)

listContacts(request: protos.google.cloud.essentialcontacts.v1.IListContactsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.essentialcontacts.v1.IListContactsRequest, protos.google.cloud.essentialcontacts.v1.IListContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IListContactsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.essentialcontacts.v1.IListContactsRequest, protos.google.cloud.essentialcontacts.v1.IListContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>
Returns
TypeDescription
void

listContacts(request, callback)

listContacts(request: protos.google.cloud.essentialcontacts.v1.IListContactsRequest, callback: PaginationCallback<protos.google.cloud.essentialcontacts.v1.IListContactsRequest, protos.google.cloud.essentialcontacts.v1.IListContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IListContactsRequest
callback PaginationCallback<protos.google.cloud.essentialcontacts.v1.IListContactsRequest, protos.google.cloud.essentialcontacts.v1.IListContactsResponse | null | undefined, protos.google.cloud.essentialcontacts.v1.IContact>
Returns
TypeDescription
void

listContactsAsync(request, options)

listContactsAsync(request?: protos.google.cloud.essentialcontacts.v1.IListContactsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.essentialcontacts.v1.IContact>;

Equivalent to listContacts, but returns an iterable object.

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

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IListContactsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.essentialcontacts.v1.IContact>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) 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 parent resource name.
   *  Format: organizations/{organization_id}, folders/{folder_id} or
   *  projects/{project_id}
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of results to return from this request.
   *  Non-positive values are ignored. The presence of `next_page_token` in the
   *  response indicates that more results might be available.
   *  If not specified, the default page_size is 100.
   */
  // const pageSize = 1234
  /**
   *  Optional. If present, retrieves the next batch of results from the
   *  preceding call to this method. `page_token` must be the value of
   *  `next_page_token` from the previous response. The values of other method
   *  parameters should be identical to those in the previous call.
   */
  // const pageToken = 'abc123'

  // Imports the Essentialcontacts library
  const {EssentialContactsServiceClient} = require('@google-cloud/essential-contacts').v1;

  // Instantiates a client
  const essentialcontactsClient = new EssentialContactsServiceClient();

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

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

  callListContacts();

listContactsStream(request, options)

listContactsStream(request?: protos.google.cloud.essentialcontacts.v1.IListContactsRequest, options?: CallOptions): Transform;

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

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IListContactsRequest

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 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 listContactsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

matchContactFromFolderContactName(folderContactName)

matchContactFromFolderContactName(folderContactName: string): string | number;

Parse the contact from FolderContact resource.

Parameter
NameDescription
folderContactName string

A fully-qualified path representing folder_contact resource.

Returns
TypeDescription
string | number

{string} A string representing the contact.

matchContactFromOrganizationContactName(organizationContactName)

matchContactFromOrganizationContactName(organizationContactName: string): string | number;

Parse the contact from OrganizationContact resource.

Parameter
NameDescription
organizationContactName string

A fully-qualified path representing organization_contact resource.

Returns
TypeDescription
string | number

{string} A string representing the contact.

matchContactFromProjectContactName(projectContactName)

matchContactFromProjectContactName(projectContactName: string): string | number;

Parse the contact from ProjectContact resource.

Parameter
NameDescription
projectContactName string

A fully-qualified path representing project_contact resource.

Returns
TypeDescription
string | number

{string} A string representing the contact.

matchFolderFromFolderContactName(folderContactName)

matchFolderFromFolderContactName(folderContactName: string): string | number;

Parse the folder from FolderContact resource.

Parameter
NameDescription
folderContactName string

A fully-qualified path representing folder_contact resource.

Returns
TypeDescription
string | number

{string} A string representing the folder.

matchOrganizationFromOrganizationContactName(organizationContactName)

matchOrganizationFromOrganizationContactName(organizationContactName: string): string | number;

Parse the organization from OrganizationContact resource.

Parameter
NameDescription
organizationContactName string

A fully-qualified path representing organization_contact resource.

Returns
TypeDescription
string | number

{string} A string representing the organization.

matchProjectFromProjectContactName(projectContactName)

matchProjectFromProjectContactName(projectContactName: string): string | number;

Parse the project from ProjectContact resource.

Parameter
NameDescription
projectContactName string

A fully-qualified path representing project_contact resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
NameDescription
projectName string

A fully-qualified path representing Project resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

organizationContactPath(organization, contact)

organizationContactPath(organization: string, contact: string): string;

Return a fully-qualified organizationContact resource name string.

Parameters
NameDescription
organization string
contact string
Returns
TypeDescription
string

{string} Resource name string.

projectContactPath(project, contact)

projectContactPath(project: string, contact: string): string;

Return a fully-qualified projectContact resource name string.

Parameters
NameDescription
project string
contact string
Returns
TypeDescription
string

{string} Resource name string.

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
NameDescription
project string
Returns
TypeDescription
string

{string} Resource name string.

sendTestMessage(request, options)

sendTestMessage(request?: protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest | undefined),
        {} | undefined
    ]>;

Allows a contact admin to send a test message to contact to verify that it has been configured correctly.

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 list of names of the contacts to send a test message to.
   *  Format: organizations/{organization_id}/contacts/{contact_id},
   *  folders/{folder_id}/contacts/{contact_id} or
   *  projects/{project_id}/contacts/{contact_id}
   */
  // const contacts = 'abc123'
  /**
   *  Required. The name of the resource to send the test message for. All
   *  contacts must either be set directly on this resource or inherited from
   *  another resource that is an ancestor of this one. Format:
   *  organizations/{organization_id}, folders/{folder_id} or
   *  projects/{project_id}
   */
  // const resource = 'abc123'
  /**
   *  Required. The notification category to send the test message for. All
   *  contacts must be subscribed to this category.
   */
  // const notificationCategory = {}

  // Imports the Essentialcontacts library
  const {EssentialContactsServiceClient} = require('@google-cloud/essential-contacts').v1;

  // Instantiates a client
  const essentialcontactsClient = new EssentialContactsServiceClient();

  async function callSendTestMessage() {
    // Construct request
    const request = {
      contacts,
      resource,
      notificationCategory,
    };

    // Run request
    const response = await essentialcontactsClient.sendTestMessage(request);
    console.log(response);
  }

  callSendTestMessage();

sendTestMessage(request, options, callback)

sendTestMessage(request: protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

sendTestMessage(request, callback)

sendTestMessage(request: protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.essentialcontacts.v1.ISendTestMessageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateContact(request, options)

updateContact(request?: protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest, options?: CallOptions): Promise<[
        protos.google.cloud.essentialcontacts.v1.IContact,
        (protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest | undefined),
        {} | undefined
    ]>;

Updates a contact. Note: A contact's email address cannot be changed.

Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.essentialcontacts.v1.IContact, (protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 contact resource to replace the existing saved contact. Note:
   *  the email address of the contact cannot be modified.
   */
  // const contact = {}
  /**
   *  Optional. The update mask applied to the resource. For the `FieldMask`
   *  definition, see
   *  https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
   */
  // const updateMask = {}

  // Imports the Essentialcontacts library
  const {EssentialContactsServiceClient} = require('@google-cloud/essential-contacts').v1;

  // Instantiates a client
  const essentialcontactsClient = new EssentialContactsServiceClient();

  async function callUpdateContact() {
    // Construct request
    const request = {
      contact,
    };

    // Run request
    const response = await essentialcontactsClient.updateContact(request);
    console.log(response);
  }

  callUpdateContact();

updateContact(request, options, callback)

updateContact(request: protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest, options: CallOptions, callback: Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest
options CallOptions
callback Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateContact(request, callback)

updateContact(request: protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest, callback: Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest
callback Callback<protos.google.cloud.essentialcontacts.v1.IContact, protos.google.cloud.essentialcontacts.v1.IUpdateContactRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void