New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

googleapis

Package Overview
Dependencies
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

googleapis - npm Package Compare versions

Comparing version 0.2.8-alpha to 0.2.9-alpha

.cache/drivev2

1

lib/auth/oauth2client.js

@@ -163,2 +163,3 @@ /**

credentials.token_type = credentials.token_type || 'Bearer';
opts.headers = opts.headers || {};

@@ -165,0 +166,0 @@ opts.headers['Authorization']

13

lib/requests.js

@@ -173,12 +173,5 @@ /**

Request.prototype.handleResponse = function(opt_fn) {
return function(errors, results, res) {
var result = null;
if (results) {
result = results[0].result;
}
var err = null;
if (errors) {
err = errors[0];
}
return function(err, results, res) {
var result = results && results[0] && results[0].result;
err = err && util.isArray(err) ? err[0] : err;
opt_fn && opt_fn(err, result, res);

@@ -185,0 +178,0 @@ };

{
"name": "googleapis",
"version": "0.2.8-alpha",
"version": "0.2.9-alpha",
"author": "Google Inc.",

@@ -5,0 +5,0 @@ "description": "Google APIs Client Library for Node.js",

@@ -26,17 +26,19 @@ # google-api-nodejs-client [alpha]

var googleapis = require('googleapis');
~~~~ js
var googleapis = require('googleapis');
googleapis
.discover('urlshortener', 'v1')
.discover('plus', 'v3')
.execute(function(err, client) {
var params = { shortUrl: 'http://goo.gl/DdUKX' };
var req1 = client.urlshortener.url.get(params);
req1.execute(function (err, response) {
console.log('Long url is', response.longUrl);
});
googleapis
.discover('urlshortener', 'v1')
.discover('plus', 'v3')
.execute(function(err, client) {
var params = { shortUrl: 'http://goo.gl/DdUKX' };
var req1 = client.urlshortener.url.get(params);
req1.execute(function (err, response) {
console.log('Long url is', response.longUrl);
});
var req2 = client.plus.people.get({ userId: '+BurcuDogan' });
req2.execute();
});
var req2 = client.plus.people.get({ userId: '+BurcuDogan' });
req2.execute();
});
~~~~

@@ -54,7 +56,9 @@ Supported APIs are listed on

googleapis
.discover('urlshortener', 'v1')
.execute(function(err, client) {
// make requests
});
~~~~ js
googleapis
.discover('urlshortener', 'v1')
.execute(function(err, client) {
// make requests
});
~~~~

@@ -65,8 +69,10 @@ Alternatively, you may like to configure the client to append an API key to all

googleapis
.discover('urlshortener', 'v1')
.withApiKey('YOUR API KEY HERE')
.execute(function(err, client) {
// make requests
});
~~~~ js
googleapis
.discover('urlshortener', 'v1')
.withApiKey('YOUR API KEY HERE')
.execute(function(err, client) {
// make requests
});
~~~~

@@ -80,8 +86,10 @@ To learn more about API keys, please see the [documentation](https://developers.google.com/console/help/#UsingKeys).

googleapis.discover('urlshortener', 'v1').execute(function(err, client) {
client.urlshortener.url.get({ shortUrl: 'http://goo.gl/DdUKX' })
.execute(function(err, result) {
// result.longUrl contains the long url.
});
~~~~ js
googleapis.discover('urlshortener', 'v1').execute(function(err, client) {
client.urlshortener.url.get({ shortUrl: 'http://goo.gl/DdUKX' })
.execute(function(err, result) {
// result.longUrl contains the long url.
});
});
~~~~

@@ -92,17 +100,19 @@ ### Batch requests

var request1 =
client.plus.people.get({ userId: '+BurcuDogan' });
var request2 =
client.urlshortener.url.insert(null, { longUrl: 'http://goo.gl/A5492' });
// create from raw action name
var request3 = client.newRequest('urlshortener.url.list');
~~~~ js
var request1 =
client.plus.people.get({ userId: '+BurcuDogan' });
var request2 =
client.urlshortener.url.insert(null, { longUrl: 'http://goo.gl/A5492' });
// create from raw action name
var request3 = client.newRequest('urlshortener.url.list');
client
.newBatchRequest()
.add(request1)
.add(request2)
.add(request3)
.execute(function(err, results) {
client
.newBatchRequest()
.add(request1)
.add(request2)
.add(request3)
.execute(function(err, results) {
});
});
~~~~

@@ -126,14 +136,16 @@ ### Authorization and Authentication

var googleapis = require('googleapis'),
OAuth2Client = googleapis.OAuth2Client;
~~~~ js
var googleapis = require('googleapis'),
OAuth2Client = googleapis.OAuth2Client;
var oauth2Client =
new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
var oauth2Client =
new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
// generates a url allows offline access and asks permissions
// for Google+ scope.
var url = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: 'https://www.googleapis.com/auth/plus.me'
});
// generates a url allows offline access and asks permissions
// for Google+ scope.
var url = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: 'https://www.googleapis.com/auth/plus.me'
});
~~~~

@@ -148,6 +160,8 @@ #### Retrieving Tokens

oauth2Client.getToken(code, function(err, tokens) {
// contains an access_token and optionally a refresh_token.
// save them permanently.
});
~~~~ js
oauth2Client.getToken(code, function(err, tokens) {
// contains an access_token and optionally a refresh_token.
// save them permanently.
});
~~~~

@@ -163,11 +177,13 @@ #### Making Authenticated Requests

oauth2Client.credentials = {
access_token: 'ACCESS TOKEN HERE',
refresh_token: 'REFRESH TOKEN HERE'
};
~~~~ js
oauth2Client.credentials = {
access_token: 'ACCESS TOKEN HERE',
refresh_token: 'REFRESH TOKEN HERE'
};
client
.plus.people.get({ userId: 'me' })
.withAuthClient(oauth2Client)
.execute(callback);
client
.plus.people.get({ userId: 'me' })
.withAuthClient(oauth2Client)
.execute(callback);
~~~~

@@ -174,0 +190,0 @@ ## License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc