Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(talent): migrate code from googleapis/nodejs-talent #2815

Merged
merged 52 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7a2673d
initial commit
jkwlui Jan 31, 2019
f56d4e4
docs(samples): fix lint and docs (#6)
jkwlui Feb 26, 2019
a5884a9
refactor: use execSync for tests (#32)
JustinBeckwith Apr 4, 2019
4c7aaac
chore: release 0.3.0 (#50)
jkwlui May 9, 2019
722c41e
chore: release 1.0.0 (#55)
bcoe May 14, 2019
01271c6
chore: release 1.0.1 (#68)
yoshi-automation Jun 14, 2019
c308b39
chore: release 1.0.2 (#72)
yoshi-automation Jun 26, 2019
404214f
chore: release 1.1.0 (#74)
yoshi-automation Jun 28, 2019
9fbabb7
chore: release 1.2.0 (#77)
yoshi-automation Jul 16, 2019
a1289a7
chore: release 1.3.0 (#86)
yoshi-automation Aug 8, 2019
47391ad
chore: release 1.4.0 (#94)
yoshi-automation Sep 16, 2019
11574e6
chore: release 1.5.1 (#115)
release-please[bot] Oct 22, 2019
e700ae9
chore: release 1.6.0 (#119)
release-please[bot] Nov 10, 2019
ffaaf3c
chore: release 1.6.1 (#123)
release-please[bot] Nov 15, 2019
c3fda3b
chore: release 1.6.2 (#138)
release-please[bot] Jan 2, 2020
a154b1e
chore(deps): update dependency mocha to v7
renovate-bot Jan 6, 2020
58da53c
chore: release 1.7.0 (#149)
release-please[bot] Jan 28, 2020
1590575
chore: release 1.7.1 (#155)
release-please[bot] Jan 30, 2020
c98f330
chore: release 2.0.0 (#164)
release-please[bot] Jun 4, 2020
2823fe1
chore(deps): update dependency mocha to v8 (#214)
renovate-bot Jun 11, 2020
f7d1d8c
chore: release 2.1.0 (#215)
release-please[bot] Jun 29, 2020
b48ec1d
chore: release 3.0.0 (#247)
release-please[bot] Oct 13, 2020
5384629
samples: add Job Search v4 samples (#255)
saumyasahu-bot Oct 14, 2020
14ae3fc
chore: release 3.0.1 (#265)
release-please[bot] Nov 11, 2020
e39b9dc
chore: release 3.0.2 (#275)
release-please[bot] Dec 2, 2020
6d9ad13
chore: release 3.1.0 (#282)
release-please[bot] Jan 12, 2021
e352e79
chore: release 3.2.0 (#288)
release-please[bot] Mar 2, 2021
6898a7e
chore: release 3.2.1 (#316)
release-please[bot] May 13, 2021
271646f
chore(deps): update dependency @types/node to v14 (#322)
renovate-bot May 21, 2021
d42bf43
chore: release 3.2.2 (#325)
release-please[bot] May 27, 2021
26b17d1
chore: release 3.2.3 (#336)
release-please[bot] Jun 22, 2021
9486d15
chore: release 3.2.4 (#343)
release-please[bot] Jun 30, 2021
39cd6b0
chore: release 3.2.5 (#346)
release-please[bot] Jul 12, 2021
fcc3803
chore: release 3.2.6 (#348)
release-please[bot] Jul 16, 2021
d406cb0
chore: release 3.2.7 (#357)
release-please[bot] Aug 17, 2021
57539a8
chore: release 3.3.0 (#358)
release-please[bot] Aug 17, 2021
269347b
chore: release 3.4.0 (#360)
release-please[bot] Aug 24, 2021
dd13e28
chore: release 3.4.1 (#363)
release-please[bot] Sep 10, 2021
aa8c87d
chore: release 3.5.0 (#366)
release-please[bot] Sep 15, 2021
7d0c147
docs(samples): add auto-generated samples for Node with api short nam…
gcf-owl-bot[bot] Sep 28, 2021
759bb24
fix: flaky sample test two ways (#375)
SurferJeffAtGoogle Oct 20, 2021
702284c
chore: release 3.5.1 (#376)
release-please[bot] Oct 20, 2021
92c87ff
chore(deps): update dependency @types/node to v16 (#377)
renovate-bot Oct 26, 2021
0f951d2
chore(deps): update dependency @types/mocha to v9 (#415)
renovate-bot May 3, 2022
56f46bf
build!: update library to use Node 12 (#420)
alexander-fenster May 17, 2022
767152a
chore(main): release 4.0.0 (#421)
release-please[bot] May 18, 2022
d0661de
chore(main): release 4.1.0 (#423)
release-please[bot] Jun 7, 2022
53c97bd
chore(main): release 4.1.1 (#433)
release-please[bot] Jul 12, 2022
60de598
fix(deps): update dependency uuid to v9 (#439)
renovate-bot Sep 9, 2022
93bf57e
chore(main): release 5.0.0 (#436)
release-please[bot] Sep 22, 2022
a054b11
Merge remote-tracking branch 'migration/main' into nodejs-talent-migr…
telpirion Nov 9, 2022
1fda1ad
add workflows
telpirion Nov 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/talent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: talent
on:
push:
branches:
- main
paths:
- 'talent/**'
pull_request:
paths:
- 'talent/**'
pull_request_target:
types: [labeled]
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3.1.0
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: 'google-github-actions/auth@v0.8.3'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3.5.1
with:
node-version: 16
- run: npm install
working-directory: talent
- run: npm test
working-directory: talent
env:
MOCHA_REPORTER_SUITENAME: talent
MOCHA_REPORTER_OUTPUT: talent_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
3 changes: 2 additions & 1 deletion .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@
"monitoring/prometheus",
"datacatalog/cloud-client",
"datacatalog/quickstart",
"datastore/functions"
"datastore/functions",
"talent"
]
3 changes: 3 additions & 0 deletions talent/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
rules:
no-console: off
30 changes: 30 additions & 0 deletions talent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@google-cloud/talent-samples",
"description": "Samples for the Cloud Talent Solution client library for Node.js",
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=12.0.0"
},
"repository": "googleapis/nodejs-talent",
"private": true,
"files": [
"*.js"
],
"scripts": {
"test": "mocha --timeout 600000",
"lint": "eslint src --ext .ts",
"lint:fix": "npm run lint -- --fix"
},
"dependencies": {
"@google-cloud/talent": "^5.0.0",
"uuid": "^9.0.0",
"yargs": "^16.0.3"
},
"devDependencies": {
"@types/mocha": "^9.0.0",
"@types/node": "^16.0.0",
"chai": "^4.2.0",
"mocha": "^8.1.3"
}
}
13 changes: 13 additions & 0 deletions talent/quickstart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2019 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
//
// https://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.
94 changes: 94 additions & 0 deletions talent/snippet/job_search_autocomplete_job_title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright 2020 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
//
// https://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';

// [START job_search_autocomplete_job_title]

const talent = require('@google-cloud/talent').v4;

/**
* Complete job title given partial text (autocomplete)
*
* @param projectId {string} Your Google Cloud Project ID
* @param tenantId {string} Identifier of the TenantId
*/
function sampleCompleteQuery(
projectId,
tenantId,
query,
numResults,
languageCode
) {
const client = new talent.CompletionClient();
// const projectId = 'Your Google Cloud Project ID';
// const tenantId = 'Your Tenant ID (using tenancy is optional)';
// const query = '[partially typed job title]';
// const numResults = 5;
// const languageCode = 'en-US';
const formattedParent = client.tenantPath(projectId, tenantId);
const languageCodes = [languageCode];
const request = {
parent: formattedParent,
query: query,
pageSize: numResults,
languageCodes: languageCodes,
};
client
.completeQuery(request)
.then(responses => {
const response = responses[0];
for (const result of response.completionResults) {
console.log(`Suggested title: ${result.suggestion}`);
// Suggestion type is JOB_TITLE or COMPANY_TITLE
console.log(`Suggestion type: ${result.type}`);
}
})
.catch(err => {
console.error(err);
});
}

// [END job_search_autocomplete_job_title]
// tslint:disable-next-line:no-any

const argv = require('yargs')
.option('project_id', {
default: 'Your Google Cloud Project ID',
string: true,
})
.option('tenant_id', {
default: 'Your Tenant ID (using tenancy is optional)',
string: true,
})
.option('query', {
default: '[partially typed job title]',
string: true,
})
.option('num_results', {
default: 5,
number: true,
})
.option('language_code', {
default: 'en-US',
string: true,
}).argv;

sampleCompleteQuery(
argv.project_id,
argv.tenant_id,
argv.query,
argv.num_results,
argv.language_code
);
63 changes: 63 additions & 0 deletions talent/snippet/job_search_batch_delete_job.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2020 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
//
// https://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';

// [START job_search_batch_delete_job]

const talent = require('@google-cloud/talent').v4;

/**
* Batch delete jobs using a filter
*
* @param projectId {string} Your Google Cloud Project ID
* @param tenantId {string} Identifier of the Tenantd
* @param filter {string} The filter string specifies the jobs to be deleted.
* For example:
* companyName = "projects/api-test-project/companies/123" AND equisitionId = "req-1"
*/
function sampleBatchDeleteJobs(projectId, tenantId, filter) {
const client = new talent.JobServiceClient();
// const projectId = 'Your Google Cloud Project ID';
// const tenantId = 'Your Tenant ID (using tenancy is optional)';
// const filter = '[Query]';
const formattedParent = client.tenantPath(projectId, tenantId);
const request = {
parent: formattedParent,
filter: filter,
};
client.batchDeleteJobs(request).catch(err => {
console.error(err);
});
console.log('Batch deleted jobs from filter');
}

// [END job_search_batch_delete_job]
// tslint:disable-next-line:no-any

const argv = require('yargs')
.option('project_id', {
default: 'Your Google Cloud Project ID',
string: true,
})
.option('tenant_id', {
default: 'Your Tenant ID (using tenancy is optional)',
string: true,
})
.option('filter', {
default: '[Query]',
string: true,
}).argv;

sampleBatchDeleteJobs(argv.project_id, argv.tenant_id, argv.filter);
91 changes: 91 additions & 0 deletions talent/snippet/job_search_commute_search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright 2020 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
//
// https://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';

// [START job_search_commute_search]

const talent = require('@google-cloud/talent').v4;

/** Search Jobs using commute distance */
function sampleSearchJobs(projectId, tenantId) {
const client = new talent.JobServiceClient();
// Iterate over all elements.
// const projectId = 'Your Google Cloud Project ID';
// const tenantId = 'Your Tenant ID (using tenancy is optional)';
const formattedParent = client.tenantPath(projectId, tenantId);
const domain = 'www.example.com';
const sessionId = 'Hashed session identifier';
const userId = 'Hashed user identifier';
const requestMetadata = {
domain: domain,
sessionId: sessionId,
userId: userId,
};
const commuteMethod = 'TRANSIT';
const seconds = 1800;
const travelDuration = {
seconds: seconds,
};
const latitude = 37.422408;
const longitude = 122.084068;
const startCoordinates = {
latitude: latitude,
longitude: longitude,
};
const commuteFilter = {
commuteMethod: commuteMethod,
travelDuration: travelDuration,
startCoordinates: startCoordinates,
};
const jobQuery = {
commuteFilter: commuteFilter,
};
const request = {
parent: formattedParent,
requestMetadata: requestMetadata,
jobQuery: jobQuery,
};

client
.searchJobs(request)
.then(responses => {
const resources = responses[0];
for (const resource of resources) {
console.log(`Job summary: ${resource.jobSummary}`);
console.log(`Job title snippet: ${resource.jobTitleSnippet}`);
const job = resource.job;
console.log(`Job name: ${job.name}`);
console.log(`Job title: ${job.title}`);
}
})
.catch(err => {
console.error(err);
});
}

// [END job_search_commute_search]
// tslint:disable-next-line:no-any

const argv = require('yargs')
.option('project_id', {
default: 'Your Google Cloud Project ID',
string: true,
})
.option('tenant_id', {
default: 'Your Tenant ID (using tenancy is optional)',
string: true,
}).argv;

sampleSearchJobs(argv.project_id, argv.tenant_id);
Loading