Class EssentialContactsServiceClient (2.3.0)

public class EssentialContactsServiceClient implements BackgroundResource

Service Description: Manages contacts for important Google Cloud notifications.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   FolderName parent = FolderName.of("[FOLDER]");
   Contact contact = Contact.newBuilder().build();
   Contact response = essentialContactsServiceClient.createContact(parent, contact);
 }
 

Note: close() needs to be called on the EssentialContactsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of EssentialContactsServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 EssentialContactsServiceSettings essentialContactsServiceSettings =
     EssentialContactsServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create(essentialContactsServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 EssentialContactsServiceSettings essentialContactsServiceSettings =
     EssentialContactsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create(essentialContactsServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 EssentialContactsServiceSettings essentialContactsServiceSettings =
     EssentialContactsServiceSettings.newBuilder()
         .setTransportChannelProvider(
             EssentialContactsServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create(essentialContactsServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > EssentialContactsServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final EssentialContactsServiceClient create()

Constructs an instance of EssentialContactsServiceClient with default settings.

Returns
TypeDescription
EssentialContactsServiceClient
Exceptions
TypeDescription
IOException

create(EssentialContactsServiceSettings settings)

public static final EssentialContactsServiceClient create(EssentialContactsServiceSettings settings)

Constructs an instance of EssentialContactsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsEssentialContactsServiceSettings
Returns
TypeDescription
EssentialContactsServiceClient
Exceptions
TypeDescription
IOException

create(EssentialContactsServiceStub stub)

public static final EssentialContactsServiceClient create(EssentialContactsServiceStub stub)

Constructs an instance of EssentialContactsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(EssentialContactsServiceSettings).

Parameter
NameDescription
stubEssentialContactsServiceStub
Returns
TypeDescription
EssentialContactsServiceClient

Constructors

EssentialContactsServiceClient(EssentialContactsServiceSettings settings)

protected EssentialContactsServiceClient(EssentialContactsServiceSettings settings)

Constructs an instance of EssentialContactsServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsEssentialContactsServiceSettings

EssentialContactsServiceClient(EssentialContactsServiceStub stub)

protected EssentialContactsServiceClient(EssentialContactsServiceStub stub)
Parameter
NameDescription
stubEssentialContactsServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

computeContacts(ComputeContactsRequest request)

public final EssentialContactsServiceClient.ComputeContactsPagedResponse computeContacts(ComputeContactsRequest request)

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ComputeContactsRequest request =
       ComputeContactsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .addAllNotificationCategories(new ArrayList<NotificationCategory>())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Contact element : essentialContactsServiceClient.computeContacts(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestComputeContactsRequest

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

Returns
TypeDescription
EssentialContactsServiceClient.ComputeContactsPagedResponse

computeContactsCallable()

public final UnaryCallable<ComputeContactsRequest,ComputeContactsResponse> computeContactsCallable()

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ComputeContactsRequest request =
       ComputeContactsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .addAllNotificationCategories(new ArrayList<NotificationCategory>())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ComputeContactsResponse response =
         essentialContactsServiceClient.computeContactsCallable().call(request);
     for (Contact element : response.getContactsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ComputeContactsRequest,ComputeContactsResponse>

computeContactsPagedCallable()

public final UnaryCallable<ComputeContactsRequest,EssentialContactsServiceClient.ComputeContactsPagedResponse> computeContactsPagedCallable()

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ComputeContactsRequest request =
       ComputeContactsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .addAllNotificationCategories(new ArrayList<NotificationCategory>())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Contact> future =
       essentialContactsServiceClient.computeContactsPagedCallable().futureCall(request);
   // Do something.
   for (Contact element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ComputeContactsRequest,ComputeContactsPagedResponse>

createContact(CreateContactRequest request)

public final Contact createContact(CreateContactRequest request)

Adds a new contact for a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   CreateContactRequest request =
       CreateContactRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setContact(Contact.newBuilder().build())
           .build();
   Contact response = essentialContactsServiceClient.createContact(request);
 }
 
Parameter
NameDescription
requestCreateContactRequest

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

Returns
TypeDescription
Contact

createContact(FolderName parent, Contact contact)

public final Contact createContact(FolderName parent, Contact contact)

Adds a new contact for a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   FolderName parent = FolderName.of("[FOLDER]");
   Contact contact = Contact.newBuilder().build();
   Contact response = essentialContactsServiceClient.createContact(parent, contact);
 }
 
Parameters
NameDescription
parentFolderName

Required. The resource to save this contact for. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

contactContact

Required. The contact to create. Must specify an email address and language tag.

Returns
TypeDescription
Contact

createContact(OrganizationName parent, Contact contact)

public final Contact createContact(OrganizationName parent, Contact contact)

Adds a new contact for a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
   Contact contact = Contact.newBuilder().build();
   Contact response = essentialContactsServiceClient.createContact(parent, contact);
 }
 
Parameters
NameDescription
parentOrganizationName

Required. The resource to save this contact for. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

contactContact

Required. The contact to create. Must specify an email address and language tag.

Returns
TypeDescription
Contact

createContact(ProjectName parent, Contact contact)

public final Contact createContact(ProjectName parent, Contact contact)

Adds a new contact for a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   Contact contact = Contact.newBuilder().build();
   Contact response = essentialContactsServiceClient.createContact(parent, contact);
 }
 
Parameters
NameDescription
parentProjectName

Required. The resource to save this contact for. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

contactContact

Required. The contact to create. Must specify an email address and language tag.

Returns
TypeDescription
Contact

createContact(String parent, Contact contact)

public final Contact createContact(String parent, Contact contact)

Adds a new contact for a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   Contact contact = Contact.newBuilder().build();
   Contact response = essentialContactsServiceClient.createContact(parent, contact);
 }
 
Parameters
NameDescription
parentString

Required. The resource to save this contact for. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

contactContact

Required. The contact to create. Must specify an email address and language tag.

Returns
TypeDescription
Contact

createContactCallable()

public final UnaryCallable<CreateContactRequest,Contact> createContactCallable()

Adds a new contact for a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   CreateContactRequest request =
       CreateContactRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setContact(Contact.newBuilder().build())
           .build();
   ApiFuture<Contact> future =
       essentialContactsServiceClient.createContactCallable().futureCall(request);
   // Do something.
   Contact response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateContactRequest,Contact>

deleteContact(ContactName name)

public final void deleteContact(ContactName name)

Deletes a contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]");
   essentialContactsServiceClient.deleteContact(name);
 }
 
Parameter
NameDescription
nameContactName

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}

deleteContact(DeleteContactRequest request)

public final void deleteContact(DeleteContactRequest request)

Deletes a contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   DeleteContactRequest request =
       DeleteContactRequest.newBuilder()
           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
           .build();
   essentialContactsServiceClient.deleteContact(request);
 }
 
Parameter
NameDescription
requestDeleteContactRequest

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

deleteContact(String name)

public final void deleteContact(String name)

Deletes a contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   String name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString();
   essentialContactsServiceClient.deleteContact(name);
 }
 
Parameter
NameDescription
nameString

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}

deleteContactCallable()

public final UnaryCallable<DeleteContactRequest,Empty> deleteContactCallable()

Deletes a contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   DeleteContactRequest request =
       DeleteContactRequest.newBuilder()
           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
           .build();
   ApiFuture<Empty> future =
       essentialContactsServiceClient.deleteContactCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteContactRequest,Empty>

getContact(ContactName name)

public final Contact getContact(ContactName name)

Gets a single contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]");
   Contact response = essentialContactsServiceClient.getContact(name);
 }
 
Parameter
NameDescription
nameContactName

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}

Returns
TypeDescription
Contact

getContact(GetContactRequest request)

public final Contact getContact(GetContactRequest request)

Gets a single contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   GetContactRequest request =
       GetContactRequest.newBuilder()
           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
           .build();
   Contact response = essentialContactsServiceClient.getContact(request);
 }
 
Parameter
NameDescription
requestGetContactRequest

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

Returns
TypeDescription
Contact

getContact(String name)

public final Contact getContact(String name)

Gets a single contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   String name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString();
   Contact response = essentialContactsServiceClient.getContact(name);
 }
 
Parameter
NameDescription
nameString

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}

Returns
TypeDescription
Contact

getContactCallable()

public final UnaryCallable<GetContactRequest,Contact> getContactCallable()

Gets a single contact.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   GetContactRequest request =
       GetContactRequest.newBuilder()
           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
           .build();
   ApiFuture<Contact> future =
       essentialContactsServiceClient.getContactCallable().futureCall(request);
   // Do something.
   Contact response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetContactRequest,Contact>

getSettings()

public final EssentialContactsServiceSettings getSettings()
Returns
TypeDescription
EssentialContactsServiceSettings

getStub()

public EssentialContactsServiceStub getStub()
Returns
TypeDescription
EssentialContactsServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listContacts(FolderName parent)

public final EssentialContactsServiceClient.ListContactsPagedResponse listContacts(FolderName parent)

Lists the contacts that have been set on a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   FolderName parent = FolderName.of("[FOLDER]");
   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentFolderName

Required. The parent resource name. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

Returns
TypeDescription
EssentialContactsServiceClient.ListContactsPagedResponse

listContacts(ListContactsRequest request)

public final EssentialContactsServiceClient.ListContactsPagedResponse listContacts(ListContactsRequest request)

Lists the contacts that have been set on a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ListContactsRequest request =
       ListContactsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Contact element : essentialContactsServiceClient.listContacts(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListContactsRequest

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

Returns
TypeDescription
EssentialContactsServiceClient.ListContactsPagedResponse

listContacts(OrganizationName parent)

public final EssentialContactsServiceClient.ListContactsPagedResponse listContacts(OrganizationName parent)

Lists the contacts that have been set on a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentOrganizationName

Required. The parent resource name. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

Returns
TypeDescription
EssentialContactsServiceClient.ListContactsPagedResponse

listContacts(ProjectName parent)

public final EssentialContactsServiceClient.ListContactsPagedResponse listContacts(ProjectName parent)

Lists the contacts that have been set on a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentProjectName

Required. The parent resource name. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

Returns
TypeDescription
EssentialContactsServiceClient.ListContactsPagedResponse

listContacts(String parent)

public final EssentialContactsServiceClient.ListContactsPagedResponse listContacts(String parent)

Lists the contacts that have been set on a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The parent resource name. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}

Returns
TypeDescription
EssentialContactsServiceClient.ListContactsPagedResponse

listContactsCallable()

public final UnaryCallable<ListContactsRequest,ListContactsResponse> listContactsCallable()

Lists the contacts that have been set on a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ListContactsRequest request =
       ListContactsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListContactsResponse response =
         essentialContactsServiceClient.listContactsCallable().call(request);
     for (Contact element : response.getContactsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListContactsRequest,ListContactsResponse>

listContactsPagedCallable()

public final UnaryCallable<ListContactsRequest,EssentialContactsServiceClient.ListContactsPagedResponse> listContactsPagedCallable()

Lists the contacts that have been set on a resource.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   ListContactsRequest request =
       ListContactsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Contact> future =
       essentialContactsServiceClient.listContactsPagedCallable().futureCall(request);
   // Do something.
   for (Contact element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListContactsRequest,ListContactsPagedResponse>

sendTestMessage(SendTestMessageRequest request)

public final void sendTestMessage(SendTestMessageRequest request)

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   SendTestMessageRequest request =
       SendTestMessageRequest.newBuilder()
           .addAllContacts(new ArrayList<String>())
           .setResource(ProjectName.of("[PROJECT]").toString())
           .setNotificationCategory(NotificationCategory.forNumber(0))
           .build();
   essentialContactsServiceClient.sendTestMessage(request);
 }
 
Parameter
NameDescription
requestSendTestMessageRequest

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

sendTestMessageCallable()

public final UnaryCallable<SendTestMessageRequest,Empty> sendTestMessageCallable()

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   SendTestMessageRequest request =
       SendTestMessageRequest.newBuilder()
           .addAllContacts(new ArrayList<String>())
           .setResource(ProjectName.of("[PROJECT]").toString())
           .setNotificationCategory(NotificationCategory.forNumber(0))
           .build();
   ApiFuture<Empty> future =
       essentialContactsServiceClient.sendTestMessageCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SendTestMessageRequest,Empty>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateContact(Contact contact, FieldMask updateMask)

public final Contact updateContact(Contact contact, FieldMask updateMask)

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   Contact contact = Contact.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Contact response = essentialContactsServiceClient.updateContact(contact, updateMask);
 }
 
Parameters
NameDescription
contactContact

Required. The contact resource to replace the existing saved contact. Note: the email address of the contact cannot be modified.

updateMaskFieldMask

Optional. The update mask applied to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask

Returns
TypeDescription
Contact

updateContact(UpdateContactRequest request)

public final Contact updateContact(UpdateContactRequest request)

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   UpdateContactRequest request =
       UpdateContactRequest.newBuilder()
           .setContact(Contact.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Contact response = essentialContactsServiceClient.updateContact(request);
 }
 
Parameter
NameDescription
requestUpdateContactRequest

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

Returns
TypeDescription
Contact

updateContactCallable()

public final UnaryCallable<UpdateContactRequest,Contact> updateContactCallable()

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

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (EssentialContactsServiceClient essentialContactsServiceClient =
     EssentialContactsServiceClient.create()) {
   UpdateContactRequest request =
       UpdateContactRequest.newBuilder()
           .setContact(Contact.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Contact> future =
       essentialContactsServiceClient.updateContactCallable().futureCall(request);
   // Do something.
   Contact response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateContactRequest,Contact>