Essential Contacts v1 API - Class EssentialContactsServiceClient (2.4.0)

public abstract class EssentialContactsServiceClient

Reference documentation and code samples for the Essential Contacts v1 API class EssentialContactsServiceClient.

EssentialContactsService client wrapper, for convenient use.

Inheritance

object > EssentialContactsServiceClient

Namespace

Google.Cloud.EssentialContacts.V1

Assembly

Google.Cloud.EssentialContacts.V1.dll

Remarks

Manages contacts for important Google Cloud notifications.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the EssentialContactsService service, which is a host of "essentialcontacts.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default EssentialContactsService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default EssentialContactsService scopes are:

GrpcClient

public virtual EssentialContactsService.EssentialContactsServiceClient GrpcClient { get; }

The underlying gRPC EssentialContactsService client

Property Value
Type Description
EssentialContactsServiceEssentialContactsServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

ComputeContacts(ComputeContactsRequest, CallSettings)

public virtual PagedEnumerable<ComputeContactsResponse, Contact> ComputeContacts(ComputeContactsRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request ComputeContactsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableComputeContactsResponseContact

A pageable sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
ComputeContactsRequest request = new ComputeContactsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    NotificationCategories =
    {
        NotificationCategory.Unspecified,
    },
};
// Make the request
PagedEnumerable<ComputeContactsResponse, Contact> response = essentialContactsServiceClient.ComputeContacts(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Contact item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ComputeContactsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ComputeContactsAsync(ComputeContactsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ComputeContactsResponse, Contact> ComputeContactsAsync(ComputeContactsRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request ComputeContactsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableComputeContactsResponseContact

A pageable asynchronous sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ComputeContactsRequest request = new ComputeContactsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    NotificationCategories =
    {
        NotificationCategory.Unspecified,
    },
};
// Make the request
PagedAsyncEnumerable<ComputeContactsResponse, Contact> response = essentialContactsServiceClient.ComputeContactsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Contact item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ComputeContactsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

Create()

public static EssentialContactsServiceClient Create()

Synchronously creates a EssentialContactsServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EssentialContactsServiceClientBuilder.

Returns
Type Description
EssentialContactsServiceClient

The created EssentialContactsServiceClient.

CreateAsync(CancellationToken)

public static Task<EssentialContactsServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a EssentialContactsServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EssentialContactsServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskEssentialContactsServiceClient

The task representing the created EssentialContactsServiceClient.

CreateContact(FolderName, Contact, CallSettings)

public virtual Contact CreateContact(FolderName parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent FolderName

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
Contact contact = new Contact();
// Make the request
Contact response = essentialContactsServiceClient.CreateContact(parent, contact);

CreateContact(OrganizationName, Contact, CallSettings)

public virtual Contact CreateContact(OrganizationName parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent OrganizationName

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
Contact contact = new Contact();
// Make the request
Contact response = essentialContactsServiceClient.CreateContact(parent, contact);

CreateContact(ProjectName, Contact, CallSettings)

public virtual Contact CreateContact(ProjectName parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent ProjectName

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Contact contact = new Contact();
// Make the request
Contact response = essentialContactsServiceClient.CreateContact(parent, contact);

CreateContact(CreateContactRequest, CallSettings)

public virtual Contact CreateContact(CreateContactRequest request, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
request CreateContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
CreateContactRequest request = new CreateContactRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Contact = new Contact(),
};
// Make the request
Contact response = essentialContactsServiceClient.CreateContact(request);

CreateContact(string, Contact, CallSettings)

public virtual Contact CreateContact(string parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent string

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Contact contact = new Contact();
// Make the request
Contact response = essentialContactsServiceClient.CreateContact(parent, contact);

CreateContactAsync(FolderName, Contact, CallSettings)

public virtual Task<Contact> CreateContactAsync(FolderName parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent FolderName

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

CreateContactAsync(FolderName, Contact, CancellationToken)

public virtual Task<Contact> CreateContactAsync(FolderName parent, Contact contact, CancellationToken cancellationToken)

Adds a new contact for a resource.

Parameters
Name Description
parent FolderName

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

contact Contact

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

CreateContactAsync(OrganizationName, Contact, CallSettings)

public virtual Task<Contact> CreateContactAsync(OrganizationName parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent OrganizationName

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

CreateContactAsync(OrganizationName, Contact, CancellationToken)

public virtual Task<Contact> CreateContactAsync(OrganizationName parent, Contact contact, CancellationToken cancellationToken)

Adds a new contact for a resource.

Parameters
Name Description
parent OrganizationName

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

contact Contact

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

CreateContactAsync(ProjectName, Contact, CallSettings)

public virtual Task<Contact> CreateContactAsync(ProjectName parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent ProjectName

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

CreateContactAsync(ProjectName, Contact, CancellationToken)

public virtual Task<Contact> CreateContactAsync(ProjectName parent, Contact contact, CancellationToken cancellationToken)

Adds a new contact for a resource.

Parameters
Name Description
parent ProjectName

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

contact Contact

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

CreateContactAsync(CreateContactRequest, CallSettings)

public virtual Task<Contact> CreateContactAsync(CreateContactRequest request, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
request CreateContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
CreateContactRequest request = new CreateContactRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Contact = new Contact(),
};
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(request);

CreateContactAsync(CreateContactRequest, CancellationToken)

public virtual Task<Contact> CreateContactAsync(CreateContactRequest request, CancellationToken cancellationToken)

Adds a new contact for a resource.

Parameters
Name Description
request CreateContactRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
CreateContactRequest request = new CreateContactRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Contact = new Contact(),
};
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(request);

CreateContactAsync(string, Contact, CallSettings)

public virtual Task<Contact> CreateContactAsync(string parent, Contact contact, CallSettings callSettings = null)

Adds a new contact for a resource.

Parameters
Name Description
parent string

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

contact Contact

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

CreateContactAsync(string, Contact, CancellationToken)

public virtual Task<Contact> CreateContactAsync(string parent, Contact contact, CancellationToken cancellationToken)

Adds a new contact for a resource.

Parameters
Name Description
parent string

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

contact Contact

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Contact contact = new Contact();
// Make the request
Contact response = await essentialContactsServiceClient.CreateContactAsync(parent, contact);

DeleteContact(ContactName, CallSettings)

public virtual void DeleteContact(ContactName name, CallSettings callSettings = null)

Deletes a contact.

Parameters
Name Description
name ContactName

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
ContactName name = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]");
// Make the request
essentialContactsServiceClient.DeleteContact(name);

DeleteContact(DeleteContactRequest, CallSettings)

public virtual void DeleteContact(DeleteContactRequest request, CallSettings callSettings = null)

Deletes a contact.

Parameters
Name Description
request DeleteContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
DeleteContactRequest request = new DeleteContactRequest
{
    ContactName = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
};
// Make the request
essentialContactsServiceClient.DeleteContact(request);

DeleteContact(string, CallSettings)

public virtual void DeleteContact(string name, CallSettings callSettings = null)

Deletes a contact.

Parameters
Name Description
name string

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/contacts/[CONTACT]";
// Make the request
essentialContactsServiceClient.DeleteContact(name);

DeleteContactAsync(ContactName, CallSettings)

public virtual Task DeleteContactAsync(ContactName name, CallSettings callSettings = null)

Deletes a contact.

Parameters
Name Description
name ContactName

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ContactName name = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]");
// Make the request
await essentialContactsServiceClient.DeleteContactAsync(name);

DeleteContactAsync(ContactName, CancellationToken)

public virtual Task DeleteContactAsync(ContactName name, CancellationToken cancellationToken)

Deletes a contact.

Parameters
Name Description
name ContactName

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}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ContactName name = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]");
// Make the request
await essentialContactsServiceClient.DeleteContactAsync(name);

DeleteContactAsync(DeleteContactRequest, CallSettings)

public virtual Task DeleteContactAsync(DeleteContactRequest request, CallSettings callSettings = null)

Deletes a contact.

Parameters
Name Description
request DeleteContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteContactRequest request = new DeleteContactRequest
{
    ContactName = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
};
// Make the request
await essentialContactsServiceClient.DeleteContactAsync(request);

DeleteContactAsync(DeleteContactRequest, CancellationToken)

public virtual Task DeleteContactAsync(DeleteContactRequest request, CancellationToken cancellationToken)

Deletes a contact.

Parameters
Name Description
request DeleteContactRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteContactRequest request = new DeleteContactRequest
{
    ContactName = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
};
// Make the request
await essentialContactsServiceClient.DeleteContactAsync(request);

DeleteContactAsync(string, CallSettings)

public virtual Task DeleteContactAsync(string name, CallSettings callSettings = null)

Deletes a contact.

Parameters
Name Description
name string

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/contacts/[CONTACT]";
// Make the request
await essentialContactsServiceClient.DeleteContactAsync(name);

DeleteContactAsync(string, CancellationToken)

public virtual Task DeleteContactAsync(string name, CancellationToken cancellationToken)

Deletes a contact.

Parameters
Name Description
name string

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}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/contacts/[CONTACT]";
// Make the request
await essentialContactsServiceClient.DeleteContactAsync(name);

GetContact(ContactName, CallSettings)

public virtual Contact GetContact(ContactName name, CallSettings callSettings = null)

Gets a single contact.

Parameters
Name Description
name ContactName

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
ContactName name = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]");
// Make the request
Contact response = essentialContactsServiceClient.GetContact(name);

GetContact(GetContactRequest, CallSettings)

public virtual Contact GetContact(GetContactRequest request, CallSettings callSettings = null)

Gets a single contact.

Parameters
Name Description
request GetContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
GetContactRequest request = new GetContactRequest
{
    ContactName = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
};
// Make the request
Contact response = essentialContactsServiceClient.GetContact(request);

GetContact(string, CallSettings)

public virtual Contact GetContact(string name, CallSettings callSettings = null)

Gets a single contact.

Parameters
Name Description
name string

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/contacts/[CONTACT]";
// Make the request
Contact response = essentialContactsServiceClient.GetContact(name);

GetContactAsync(ContactName, CallSettings)

public virtual Task<Contact> GetContactAsync(ContactName name, CallSettings callSettings = null)

Gets a single contact.

Parameters
Name Description
name ContactName

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ContactName name = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]");
// Make the request
Contact response = await essentialContactsServiceClient.GetContactAsync(name);

GetContactAsync(ContactName, CancellationToken)

public virtual Task<Contact> GetContactAsync(ContactName name, CancellationToken cancellationToken)

Gets a single contact.

Parameters
Name Description
name ContactName

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}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ContactName name = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]");
// Make the request
Contact response = await essentialContactsServiceClient.GetContactAsync(name);

GetContactAsync(GetContactRequest, CallSettings)

public virtual Task<Contact> GetContactAsync(GetContactRequest request, CallSettings callSettings = null)

Gets a single contact.

Parameters
Name Description
request GetContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
GetContactRequest request = new GetContactRequest
{
    ContactName = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
};
// Make the request
Contact response = await essentialContactsServiceClient.GetContactAsync(request);

GetContactAsync(GetContactRequest, CancellationToken)

public virtual Task<Contact> GetContactAsync(GetContactRequest request, CancellationToken cancellationToken)

Gets a single contact.

Parameters
Name Description
request GetContactRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
GetContactRequest request = new GetContactRequest
{
    ContactName = ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
};
// Make the request
Contact response = await essentialContactsServiceClient.GetContactAsync(request);

GetContactAsync(string, CallSettings)

public virtual Task<Contact> GetContactAsync(string name, CallSettings callSettings = null)

Gets a single contact.

Parameters
Name Description
name string

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}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/contacts/[CONTACT]";
// Make the request
Contact response = await essentialContactsServiceClient.GetContactAsync(name);

GetContactAsync(string, CancellationToken)

public virtual Task<Contact> GetContactAsync(string name, CancellationToken cancellationToken)

Gets a single contact.

Parameters
Name Description
name string

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}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/contacts/[CONTACT]";
// Make the request
Contact response = await essentialContactsServiceClient.GetContactAsync(name);

ListContacts(FolderName, string, int?, CallSettings)

public virtual PagedEnumerable<ListContactsResponse, Contact> ListContacts(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent FolderName

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListContactsResponseContact

A pageable sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContacts(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Contact item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListContactsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContacts(OrganizationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListContactsResponse, Contact> ListContacts(OrganizationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent OrganizationName

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListContactsResponseContact

A pageable sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContacts(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Contact item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListContactsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContacts(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListContactsResponse, Contact> ListContacts(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent ProjectName

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListContactsResponseContact

A pageable sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContacts(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Contact item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListContactsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContacts(ListContactsRequest, CallSettings)

public virtual PagedEnumerable<ListContactsResponse, Contact> ListContacts(ListContactsRequest request, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
request ListContactsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListContactsResponseContact

A pageable sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
ListContactsRequest request = new ListContactsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContacts(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Contact item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListContactsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContacts(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListContactsResponse, Contact> ListContacts(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent string

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListContactsResponseContact

A pageable sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContacts(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Contact item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListContactsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContactsAsync(FolderName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListContactsResponse, Contact> ListContactsAsync(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent FolderName

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListContactsResponseContact

A pageable asynchronous sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedAsyncEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContactsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Contact item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListContactsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContactsAsync(OrganizationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListContactsResponse, Contact> ListContactsAsync(OrganizationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent OrganizationName

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListContactsResponseContact

A pageable asynchronous sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedAsyncEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContactsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Contact item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListContactsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContactsAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListContactsResponse, Contact> ListContactsAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent ProjectName

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListContactsResponseContact

A pageable asynchronous sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContactsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Contact item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListContactsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContactsAsync(ListContactsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListContactsResponse, Contact> ListContactsAsync(ListContactsRequest request, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
request ListContactsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListContactsResponseContact

A pageable asynchronous sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
ListContactsRequest request = new ListContactsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContactsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Contact item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListContactsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListContactsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListContactsResponse, Contact> ListContactsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the contacts that have been set on a resource.

Parameters
Name Description
parent string

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

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListContactsResponseContact

A pageable asynchronous sequence of Contact resources.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListContactsResponse, Contact> response = essentialContactsServiceClient.ListContactsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Contact item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListContactsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Contact item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Contact> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Contact item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SendTestMessage(SendTestMessageRequest, CallSettings)

public virtual void SendTestMessage(SendTestMessageRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request SendTestMessageRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
SendTestMessageRequest request = new SendTestMessageRequest
{
    ContactsAsContactNames =
    {
        ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
    },
    ResourceAsProjectName = ProjectName.FromProject("[PROJECT]"),
    NotificationCategory = NotificationCategory.Unspecified,
};
// Make the request
essentialContactsServiceClient.SendTestMessage(request);

SendTestMessageAsync(SendTestMessageRequest, CallSettings)

public virtual Task SendTestMessageAsync(SendTestMessageRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request SendTestMessageRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
SendTestMessageRequest request = new SendTestMessageRequest
{
    ContactsAsContactNames =
    {
        ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
    },
    ResourceAsProjectName = ProjectName.FromProject("[PROJECT]"),
    NotificationCategory = NotificationCategory.Unspecified,
};
// Make the request
await essentialContactsServiceClient.SendTestMessageAsync(request);

SendTestMessageAsync(SendTestMessageRequest, CancellationToken)

public virtual Task SendTestMessageAsync(SendTestMessageRequest request, CancellationToken cancellationToken)

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

Parameters
Name Description
request SendTestMessageRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
SendTestMessageRequest request = new SendTestMessageRequest
{
    ContactsAsContactNames =
    {
        ContactName.FromProjectContact("[PROJECT]", "[CONTACT]"),
    },
    ResourceAsProjectName = ProjectName.FromProject("[PROJECT]"),
    NotificationCategory = NotificationCategory.Unspecified,
};
// Make the request
await essentialContactsServiceClient.SendTestMessageAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateContact(Contact, FieldMask, CallSettings)

public virtual Contact UpdateContact(Contact contact, FieldMask updateMask, CallSettings callSettings = null)

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

Parameters
Name Description
contact Contact

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

updateMask FieldMask

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
Contact contact = new Contact();
FieldMask updateMask = new FieldMask();
// Make the request
Contact response = essentialContactsServiceClient.UpdateContact(contact, updateMask);

UpdateContact(UpdateContactRequest, CallSettings)

public virtual Contact UpdateContact(UpdateContactRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request UpdateContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Contact

The RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = EssentialContactsServiceClient.Create();
// Initialize request argument(s)
UpdateContactRequest request = new UpdateContactRequest
{
    Contact = new Contact(),
    UpdateMask = new FieldMask(),
};
// Make the request
Contact response = essentialContactsServiceClient.UpdateContact(request);

UpdateContactAsync(Contact, FieldMask, CallSettings)

public virtual Task<Contact> UpdateContactAsync(Contact contact, FieldMask updateMask, CallSettings callSettings = null)

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

Parameters
Name Description
contact Contact

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

updateMask FieldMask

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
Contact contact = new Contact();
FieldMask updateMask = new FieldMask();
// Make the request
Contact response = await essentialContactsServiceClient.UpdateContactAsync(contact, updateMask);

UpdateContactAsync(Contact, FieldMask, CancellationToken)

public virtual Task<Contact> UpdateContactAsync(Contact contact, FieldMask updateMask, CancellationToken cancellationToken)

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

Parameters
Name Description
contact Contact

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

updateMask FieldMask

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
Contact contact = new Contact();
FieldMask updateMask = new FieldMask();
// Make the request
Contact response = await essentialContactsServiceClient.UpdateContactAsync(contact, updateMask);

UpdateContactAsync(UpdateContactRequest, CallSettings)

public virtual Task<Contact> UpdateContactAsync(UpdateContactRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request UpdateContactRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateContactRequest request = new UpdateContactRequest
{
    Contact = new Contact(),
    UpdateMask = new FieldMask(),
};
// Make the request
Contact response = await essentialContactsServiceClient.UpdateContactAsync(request);

UpdateContactAsync(UpdateContactRequest, CancellationToken)

public virtual Task<Contact> UpdateContactAsync(UpdateContactRequest request, CancellationToken cancellationToken)

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

Parameters
Name Description
request UpdateContactRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskContact

A Task containing the RPC response.

Example
// Create client
EssentialContactsServiceClient essentialContactsServiceClient = await EssentialContactsServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateContactRequest request = new UpdateContactRequest
{
    Contact = new Contact(),
    UpdateMask = new FieldMask(),
};
// Make the request
Contact response = await essentialContactsServiceClient.UpdateContactAsync(request);