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

Update jobs sample #880

Merged
merged 2 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
8 changes: 2 additions & 6 deletions jobs/cjd_sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@
"test": "repo-tools test run --cmd ava -- -T 20s --verbose system-test/*.test.js"
},
"dependencies": {
"googleapis": "27.0.0",
"safe-buffer": "5.1.1",
"uuid": "^3.2.1",
"yargs": "11.0.0"
"googleapis": "^35.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"ava": "0.25.0",
"proxyquire": "2.0.1",
"semistandard": "^12.0.1"
"semistandard": "^13.0.1"
}
}
19 changes: 3 additions & 16 deletions jobs/cjd_sample/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,13 @@
// [START quickstart]

// Imports the Google APIs client library
const {google} = require('googleapis');

// Acquires credentials
google.auth.getApplicationDefault((err, authClient) => {
if (err) {
console.error('Failed to acquire credentials');
console.error(err);
return;
}

if (authClient.createScopedRequired && authClient.createScopedRequired()) {
authClient = authClient.createScoped([
'https://www.googleapis.com/auth/jobs'
]);
}
const { google } = require('googleapis');

google.auth.getClient({ scopes: ['https://www.googleapis.com/auth/jobs'] }).then((auth) => {
// Instantiates an authorized client
const jobs = google.jobs({
version: 'v2',
auth: authClient
auth
});

// Lists companies
Expand Down