Skip to content

Commit

Permalink
docs(samples): add example tags to generated samples (#59)
Browse files Browse the repository at this point in the history
* docs(samples): add example tags to generated samples

PiperOrigin-RevId: 408439482

Source-Link: googleapis/googleapis@b9f6184

Source-Link: googleapis/googleapis-gen@eb888bc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Nov 12, 2021
1 parent eb422ee commit 270d38f
Show file tree
Hide file tree
Showing 9 changed files with 644 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"img.shields.io"
],
"silent": true,
"concurrency": 10
"concurrency": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(parent) {
// [START essentialcontacts_v1_generated_EssentialContactsService_ComputeContacts_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the resource to compute contacts for.
* Format: organizations/{organization_id},
* folders/{folder_id} or projects/{project_id}
*/
// const parent = 'abc123'
/**
* The categories of notifications to compute contacts for. If ALL is included
* in this list, contacts subscribed to any notification category will be
* returned.
*/
// const notificationCategories = 1234
/**
* Optional. The maximum number of results to return from this request.
* Non-positive values are ignored. The presence of `next_page_token` in the
* response indicates that more results might be available.
* If not specified, the default page_size is 100.
*/
// const pageSize = 1234
/**
* Optional. If present, retrieves the next batch of results from the
* preceding call to this method. `page_token` must be the value of
* `next_page_token` from the previous response. The values of other method
* parameters should be identical to those in the previous call.
*/
// const pageToken = 'abc123'

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

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

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

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

callComputeContacts();
// [END essentialcontacts_v1_generated_EssentialContactsService_ComputeContacts_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(parent, contact) {
// [START essentialcontacts_v1_generated_EssentialContactsService_CreateContact_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource to save this contact for.
* Format: organizations/{organization_id}, folders/{folder_id} or
* projects/{project_id}
*/
// const parent = 'abc123'
/**
* Required. The contact to create. Must specify an email address and language
* tag.
*/
// const contact = {}

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

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

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

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

callCreateContact();
// [END essentialcontacts_v1_generated_EssentialContactsService_CreateContact_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(name) {
// [START essentialcontacts_v1_generated_EssentialContactsService_DeleteContact_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the contact to delete.
* Format: organizations/{organization_id}/contacts/{contact_id},
* folders/{folder_id}/contacts/{contact_id} or
* projects/{project_id}/contacts/{contact_id}
*/
// const name = 'abc123'

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

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

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

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

callDeleteContact();
// [END essentialcontacts_v1_generated_EssentialContactsService_DeleteContact_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(name) {
// [START essentialcontacts_v1_generated_EssentialContactsService_GetContact_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the contact to retrieve.
* Format: organizations/{organization_id}/contacts/{contact_id},
* folders/{folder_id}/contacts/{contact_id} or
* projects/{project_id}/contacts/{contact_id}
*/
// const name = 'abc123'

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

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

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

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

callGetContact();
// [END essentialcontacts_v1_generated_EssentialContactsService_GetContact_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(parent) {
// [START essentialcontacts_v1_generated_EssentialContactsService_ListContacts_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource name.
* Format: organizations/{organization_id}, folders/{folder_id} or
* projects/{project_id}
*/
// const parent = 'abc123'
/**
* Optional. The maximum number of results to return from this request.
* Non-positive values are ignored. The presence of `next_page_token` in the
* response indicates that more results might be available.
* If not specified, the default page_size is 100.
*/
// const pageSize = 1234
/**
* Optional. If present, retrieves the next batch of results from the
* preceding call to this method. `page_token` must be the value of
* `next_page_token` from the previous response. The values of other method
* parameters should be identical to those in the previous call.
*/
// const pageToken = 'abc123'

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

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

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

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

callListContacts();
// [END essentialcontacts_v1_generated_EssentialContactsService_ListContacts_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit 270d38f

Please sign in to comment.