Skip to content

Commit b19ac41

Browse files
docs(samples): add auto-generated samples for Node with api short name in region tag (#371)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 399287285 Source-Link: googleapis/googleapis@1575986 Source-Link: googleapis/googleapis-gen@b27fff6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9
1 parent 0d41eb8 commit b19ac41

File tree

64 files changed

+4555
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4555
-17
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent, company) {
18+
// [START jobs_v4_generated_CompanyService_CreateCompany_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Resource name of the tenant under which the company is created.
24+
* The format is "projects/{project_id}/tenants/{tenant_id}", for example,
25+
* "projects/foo/tenants/bar".
26+
*/
27+
// const parent = 'abc123'
28+
/**
29+
* Required. The company to be created.
30+
*/
31+
// const company = ''
32+
33+
// Imports the Talent library
34+
const {CompanyServiceClient} = require('@google-cloud/talent').v4;
35+
36+
// Instantiates a client
37+
const talentClient = new CompanyServiceClient();
38+
39+
async function createCompany() {
40+
// Construct request
41+
const request = {
42+
parent,
43+
company,
44+
};
45+
46+
// Run request
47+
const response = await talentClient.createCompany(request);
48+
console.log(response);
49+
}
50+
51+
createCompany();
52+
// [END jobs_v4_generated_CompanyService_CreateCompany_async]
53+
}
54+
55+
process.on('unhandledRejection', err => {
56+
console.error(err.message);
57+
process.exitCode = 1;
58+
});
59+
main(...process.argv.slice(2));
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START jobs_v4_generated_CompanyService_DeleteCompany_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The resource name of the company to be deleted.
24+
* The format is
25+
* "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for
26+
* example, "projects/foo/tenants/bar/companies/baz".
27+
*/
28+
// const name = 'abc123'
29+
30+
// Imports the Talent library
31+
const {CompanyServiceClient} = require('@google-cloud/talent').v4;
32+
33+
// Instantiates a client
34+
const talentClient = new CompanyServiceClient();
35+
36+
async function deleteCompany() {
37+
// Construct request
38+
const request = {
39+
name,
40+
};
41+
42+
// Run request
43+
const response = await talentClient.deleteCompany(request);
44+
console.log(response);
45+
}
46+
47+
deleteCompany();
48+
// [END jobs_v4_generated_CompanyService_DeleteCompany_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START jobs_v4_generated_CompanyService_GetCompany_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The resource name of the company to be retrieved.
24+
* The format is
25+
* "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for
26+
* example, "projects/api-test-project/tenants/foo/companies/bar".
27+
*/
28+
// const name = 'abc123'
29+
30+
// Imports the Talent library
31+
const {CompanyServiceClient} = require('@google-cloud/talent').v4;
32+
33+
// Instantiates a client
34+
const talentClient = new CompanyServiceClient();
35+
36+
async function getCompany() {
37+
// Construct request
38+
const request = {
39+
name,
40+
};
41+
42+
// Run request
43+
const response = await talentClient.getCompany(request);
44+
console.log(response);
45+
}
46+
47+
getCompany();
48+
// [END jobs_v4_generated_CompanyService_GetCompany_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent) {
18+
// [START jobs_v4_generated_CompanyService_ListCompanies_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Resource name of the tenant under which the company is created.
24+
* The format is "projects/{project_id}/tenants/{tenant_id}", for example,
25+
* "projects/foo/tenants/bar".
26+
*/
27+
// const parent = 'abc123'
28+
/**
29+
* The starting indicator from which to return results.
30+
*/
31+
// const pageToken = 'abc123'
32+
/**
33+
* The maximum number of companies to be returned, at most 100.
34+
* Default is 100 if a non-positive number is provided.
35+
*/
36+
// const pageSize = 1234
37+
/**
38+
* Set to true if the companies requested must have open jobs.
39+
* Defaults to false.
40+
* If true, at most [page_size][google.cloud.talent.v4.ListCompaniesRequest.page_size] of companies are fetched, among which
41+
* only those with open jobs are returned.
42+
*/
43+
// const requireOpenJobs = true
44+
45+
// Imports the Talent library
46+
const {CompanyServiceClient} = require('@google-cloud/talent').v4;
47+
48+
// Instantiates a client
49+
const talentClient = new CompanyServiceClient();
50+
51+
async function listCompanies() {
52+
// Construct request
53+
const request = {
54+
parent,
55+
};
56+
57+
// Run request
58+
const iterable = await talentClient.listCompaniesAsync(request);
59+
for await (const response of iterable) {
60+
console.log(response);
61+
}
62+
}
63+
64+
listCompanies();
65+
// [END jobs_v4_generated_CompanyService_ListCompanies_async]
66+
}
67+
68+
process.on('unhandledRejection', err => {
69+
console.error(err.message);
70+
process.exitCode = 1;
71+
});
72+
main(...process.argv.slice(2));
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(company) {
18+
// [START jobs_v4_generated_CompanyService_UpdateCompany_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The company resource to replace the current resource in the system.
24+
*/
25+
// const company = ''
26+
/**
27+
* Strongly recommended for the best service experience.
28+
* If [update_mask][google.cloud.talent.v4.UpdateCompanyRequest.update_mask] is provided, only the specified fields in
29+
* [company][google.cloud.talent.v4.UpdateCompanyRequest.company] are updated. Otherwise all the fields are updated.
30+
* A field mask to specify the company fields to be updated. Only
31+
* top level fields of [Company][google.cloud.talent.v4.Company] are supported.
32+
*/
33+
// const updateMask = ''
34+
35+
// Imports the Talent library
36+
const {CompanyServiceClient} = require('@google-cloud/talent').v4;
37+
38+
// Instantiates a client
39+
const talentClient = new CompanyServiceClient();
40+
41+
async function updateCompany() {
42+
// Construct request
43+
const request = {
44+
company,
45+
};
46+
47+
// Run request
48+
const response = await talentClient.updateCompany(request);
49+
console.log(response);
50+
}
51+
52+
updateCompany();
53+
// [END jobs_v4_generated_CompanyService_UpdateCompany_async]
54+
}
55+
56+
process.on('unhandledRejection', err => {
57+
console.error(err.message);
58+
process.exitCode = 1;
59+
});
60+
main(...process.argv.slice(2));
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(tenant, query, pageSize) {
18+
// [START jobs_v4_generated_Completion_CompleteQuery_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Resource name of tenant the completion is performed within.
24+
* The format is "projects/{project_id}/tenants/{tenant_id}", for example,
25+
* "projects/foo/tenants/bar".
26+
*/
27+
// const tenant = 'abc123'
28+
/**
29+
* Required. The query used to generate suggestions.
30+
* The maximum number of allowed characters is 255.
31+
*/
32+
// const query = 'abc123'
33+
/**
34+
* The list of languages of the query. This is
35+
* the BCP-47 language code, such as "en-US" or "sr-Latn".
36+
* For more information, see
37+
* [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
38+
* The maximum number of allowed characters is 255.
39+
*/
40+
// const languageCodes = 'abc123'
41+
/**
42+
* Required. Completion result count.
43+
* The maximum allowed page size is 10.
44+
*/
45+
// const pageSize = 1234
46+
/**
47+
* If provided, restricts completion to specified company.
48+
* The format is
49+
* "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for
50+
* example, "projects/foo/tenants/bar/companies/baz".
51+
*/
52+
// const company = 'abc123'
53+
/**
54+
* The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4.CompleteQueryRequest.CompletionScope.PUBLIC].
55+
*/
56+
// const scope = ''
57+
/**
58+
* The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMBINED].
59+
*/
60+
// const type = ''
61+
62+
// Imports the Talent library
63+
const {CompletionClient} = require('@google-cloud/talent').v4;
64+
65+
// Instantiates a client
66+
const talentClient = new CompletionClient();
67+
68+
async function completeQuery() {
69+
// Construct request
70+
const request = {
71+
tenant,
72+
query,
73+
pageSize,
74+
};
75+
76+
// Run request
77+
const response = await talentClient.completeQuery(request);
78+
console.log(response);
79+
}
80+
81+
completeQuery();
82+
// [END jobs_v4_generated_Completion_CompleteQuery_async]
83+
}
84+
85+
process.on('unhandledRejection', err => {
86+
console.error(err.message);
87+
process.exitCode = 1;
88+
});
89+
main(...process.argv.slice(2));

0 commit comments

Comments
 (0)