Skip to content

Commit

Permalink
fix: repair a bunch of samples (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Mar 12, 2018
1 parent 8c53a84 commit 5add4c7
Show file tree
Hide file tree
Showing 17 changed files with 349 additions and 173 deletions.
144 changes: 68 additions & 76 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions samples/analytics/analytics.js
Expand Up @@ -14,9 +14,13 @@
'use strict';

const {google} = require('googleapis');
const analytics = google.analytics('v3');
const sampleClient = require('../sampleclient');

const analytics = google.analytics({
version: 'v3',
auth: sampleClient.oAuth2Client
});

// Custom Goals must be exist prior to used as an objectiveMetric
const objectiveMetric = 'ga:goal1Completions';

Expand Down Expand Up @@ -45,20 +49,23 @@ const scopes = [
'https://www.googleapis.com/auth/analytics'
];

sampleClient.authenticate(scopes, (err, authClient) => {
if (err) {
throw err;
}
function runSample () {
analytics.management.experiments.insert({
auth: authClient,
accountId: 'your-accountId',
webPropertyId: 'your-webPropertyId',
profileId: 'your-profileId',
resource: resourceBody
}, (err, body) => {
}, (err, res) => {
if (err) {
throw err;
}
console.log(body);
console.log(res.data);
});
}

sampleClient.authenticate(scopes, err => {
if (err) {
throw err;
}
runSample();
});
6 changes: 3 additions & 3 deletions samples/blogger/blogger.js
Expand Up @@ -24,9 +24,9 @@ nconf.argv().env().file(path.join(__dirname, 'config.json'));
blogger.blogs.get({
key: nconf.get('api_key'),
blogId: 3213900
}, (err, result) => {
}, (err, res) => {
if (err) {
console.error(err);
throw err;
}
console.log(result);
console.log(res.data);
});
4 changes: 2 additions & 2 deletions samples/compute/compute.js
Expand Up @@ -33,7 +33,7 @@ request.get({ uri, headers }, (err, res, project) => {
if (res.statusCode !== 200) {
throw new Error(`Response failed with status ${res.statusCode}`);
}
compute.zones.list({ project }, (err, result) => {
console.log(err, result);
compute.zones.list({ project }, (err, res) => {
console.log(err, res.data);
});
});

0 comments on commit 5add4c7

Please sign in to comment.