googleapis
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -91,14 +91,18 @@ /** | ||
/** | ||
* If the params are not present, and callback was passed instead, | ||
* use params as the callback and create empty params. | ||
*/ | ||
// If the params are not present, and callback was passed instead, | ||
// use params as the callback and create empty params. | ||
if (typeof params === 'function') { | ||
callback = params; | ||
params = {}; | ||
} else { | ||
// Create a new params object so it can no longer be modified from outside code | ||
params = utils.extend({}, params); | ||
} | ||
// Create a new params object so it can no longer be modified from outside code | ||
// Also support global and per-client params, but allow them to be overriden per-request | ||
params = utils.extend( | ||
{}, // New base object | ||
parameters.context.google._options.params, // Global params | ||
parameters.context._options.params, // Per-client params | ||
params // API call params | ||
); | ||
// Normalize callback | ||
@@ -198,2 +202,3 @@ callback = createCallback(callback); | ||
delete options.auth; // is overridden by our auth code | ||
delete options.params; // We handle params ourselves and Request does not recognise 'params' | ||
@@ -200,0 +205,0 @@ // create request (using authClient or otherwise and return request obj) |
{ | ||
"name": "googleapis", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"author": "Google Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Google APIs Client Library for Node.js", |
@@ -294,3 +294,3 @@ # Google APIs Node.js Client | ||
The options you specify are attached to the `request` object so whatever | ||
`request` supports, this library supports. | ||
`request` supports, this library supports. You may also specify global or per-service request parameters that will be attached to all API calls you make. | ||
@@ -301,3 +301,3 @@ A full list of supported options can be [found here][requestopts]. | ||
Example: Specifying a default proxy and `auth` to be used for each request. | ||
#### Example: Specifying a default proxy and `auth` to be used for each request. | ||
@@ -308,16 +308,26 @@ ``` js | ||
// all requests made with this object will use these settings unless overridden | ||
// All requests made with this object will use these settings unless overridden. | ||
``` | ||
#### Example: Specifying global request parameters. | ||
```js | ||
var google = require('googleapis'); | ||
google.options({ params: { quotaUser: 'user123@example.com' } }); | ||
// All requests from all services will contain the above query parameter | ||
// unless overriden either in a service client or in individual API calls. | ||
``` | ||
### Service-client options | ||
You can also specify options when creating a service client. For example, to | ||
specify a default `auth` option (API key or OAuth2 client), simply pass it in | ||
like so: | ||
You can also specify options when creating a service client. | ||
``` js | ||
#### Example: Specifying a default `auth` option (API key or OAuth2 client) | ||
```js | ||
var auth = 'API KEY'; // or you could use oauth2Client | ||
var urlshortener = google.urlshortener({ version: 'v1', auth: auth }); | ||
// all requests made with this object will use the specified auth | ||
// All requests made with this object will use the specified auth. | ||
``` | ||
@@ -331,2 +341,16 @@ | ||
#### Example: Specifying default service client query parameters | ||
```js | ||
var urlshortener = google.urlshortener({ | ||
version: 'v1', | ||
params: { quotaUser: 'user123@example.com' } | ||
}); | ||
// All requests made with this service client will contain the | ||
// quotaUser query parameter unless overriden in individual API calls. | ||
// Calls with this drive client will NOT contain the quotaUser query parameter. | ||
var drive = google.drive('v2'); | ||
``` | ||
### Request-level options | ||
@@ -333,0 +357,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2323692
56046
391