googleapis
Advanced tools
Comparing version 0.2.11-alpha to 0.2.12-alpha
@@ -159,4 +159,4 @@ /** | ||
if (!credentials.access_token) { | ||
throw new Error('No access token is set.'); | ||
if (!credentials.access_token && !credentials.refresh_token) { | ||
throw new Error('No access or refresh token is set.'); | ||
} | ||
@@ -163,0 +163,0 @@ |
@@ -221,3 +221,3 @@ /** | ||
* | ||
* @param {object} Options. | ||
* @param {object} opts Options. | ||
* @return {GoogleApis} Returns itself. | ||
@@ -224,0 +224,0 @@ */ |
{ | ||
"name": "googleapis", | ||
"version": "0.2.11-alpha", | ||
"version": "0.2.12-alpha", | ||
"author": "Google Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Google APIs Client Library for Node.js", |
@@ -31,3 +31,3 @@ # google-api-nodejs-client [alpha] | ||
.discover('urlshortener', 'v1') | ||
.discover('plus', 'v3') | ||
.discover('plus', 'v1') | ||
.execute(function(err, client) { | ||
@@ -77,17 +77,2 @@ var params = { shortUrl: 'http://goo.gl/DdUKX' }; | ||
Alternatively, you may like to configure the client to append an API key to all | ||
requests you are going to make. Once you load a client library, you can set an | ||
API key: | ||
~~~~ js | ||
googleapis | ||
.discover('urlshortener', 'v1') | ||
.withApiKey('YOUR API KEY HERE') | ||
.execute(function(err, client) { | ||
// make requests | ||
}); | ||
~~~~ | ||
To learn more about API keys, please see the [documentation](https://developers.google.com/console/help/#UsingKeys). | ||
### Requests | ||
@@ -101,3 +86,3 @@ | ||
client.urlshortener.url.get({ shortUrl: 'http://goo.gl/DdUKX' }) | ||
.execute(function(err, result) { | ||
.execute(function(err, result) { | ||
// result.longUrl contains the long url. | ||
@@ -108,2 +93,20 @@ }); | ||
Alternatively, you may need to send an API key with the | ||
request you are going to make. The following creates and executes a request from the Google+ API service to retrieve a person profile given a userId: | ||
~~~~ js | ||
googleapis | ||
.discover('plus', 'v1') | ||
.execute(function(err, client) { | ||
var request1 = client.plus.people.get({ userId: '+BurcuDogan' }) | ||
.withApiKey(API_KEY); | ||
request1.execute(function(err, result) { | ||
console.log("Result: " + (err ? err.message : result.displayName)); | ||
}); | ||
}); | ||
~~~~ | ||
To learn more about API keys, please see the [documentation](https://developers.google.com/console/help/#UsingKeys). | ||
### Batch requests | ||
@@ -116,7 +119,10 @@ | ||
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.urlshortener.url.insert(null, { longUrl: 'http://google.com' }); | ||
// Create from client service using the raw action name | ||
var request3 = client.urlshortener.newRequest( | ||
'urlshortener.url.get', { shortUrl: 'http://goo.gl/DdUKX' }); | ||
client | ||
@@ -123,0 +129,0 @@ .newBatchRequest() |
50386
248