googleapis
Advanced tools
Comparing version 0.2.7-alpha to 0.2.8-alpha
@@ -105,3 +105,3 @@ /** | ||
return Cache.TMP_DIR_ + '/' + api.name + api.version; | ||
} | ||
}; | ||
@@ -108,0 +108,0 @@ /** |
@@ -28,3 +28,3 @@ /** | ||
this.apiMeta = apiMeta; | ||
this.authClient = null; | ||
// generate helper methods | ||
@@ -122,8 +122,21 @@ this.registerHelpers_(); | ||
Client.prototype.newRequest = function(methodName, params, opt_resource) { | ||
return new Request(this.apiMeta, methodName, params, opt_resource); | ||
return new Request(this.apiMeta, methodName, params, opt_resource) | ||
.withAuthClient(this.authClient); | ||
}; | ||
/** | ||
* Adds global auth client. | ||
* | ||
* @param {auth.AuthClient} client An auth client instance. | ||
* | ||
* @return {Client} Returns itself. | ||
*/ | ||
Client.prototype.withAuthClient = function(client) { | ||
this.authClient = client; | ||
return this; | ||
}; | ||
/** | ||
* Exporting Client. | ||
*/ | ||
module.exports = Client; |
@@ -31,2 +31,3 @@ /** | ||
this.clients = []; | ||
this.authClient = null; | ||
} | ||
@@ -40,3 +41,3 @@ | ||
GoogleApisClient.prototype.add = function(name, client) { | ||
this[name] = client; | ||
this[name] = client.withAuthClient(this.authClient); | ||
}; | ||
@@ -49,6 +50,19 @@ | ||
GoogleApisClient.prototype.newBatchRequest = function() { | ||
return new requests.BatchRequest(); | ||
return new requests.BatchRequest() | ||
.withAuthClient(this.authClient); | ||
}; | ||
/** | ||
* Adds global auth client. | ||
* | ||
* @param {auth.AuthClient} client An auth client instance. | ||
* | ||
* @return {Client} Returns itself. | ||
*/ | ||
GoogleApisClient.prototype.withAuthClient = function(client) { | ||
this.authClient = client; | ||
return this; | ||
}; | ||
/** | ||
* @constructor | ||
@@ -61,2 +75,3 @@ * GoogleApis constructor. | ||
this.transporter = exports.Transporter || new DefaultTransporter(); | ||
this.authClient = null; | ||
} | ||
@@ -110,3 +125,4 @@ | ||
operations = [], | ||
client = new GoogleApisClient(); | ||
client = new GoogleApisClient() | ||
.withAuthClient(this.authClient); | ||
@@ -178,3 +194,3 @@ this.toBeDiscovered.forEach(function(obj) { | ||
}); | ||
} | ||
}; | ||
@@ -206,2 +222,14 @@ /** | ||
/** | ||
* Adds global auth client. | ||
* | ||
* @param {auth.AuthClient} client An auth client instance. | ||
* | ||
* @return {Client} Returns itself. | ||
*/ | ||
GoogleApis.prototype.withAuthClient = function(client) { | ||
this.authClient = client; | ||
return this; | ||
}; | ||
var googleapis = new GoogleApis(); | ||
@@ -208,0 +236,0 @@ |
@@ -18,3 +18,2 @@ /** | ||
var util = require('util'); | ||
var request = require('request'); | ||
var querystring = require('querystring'); | ||
@@ -21,0 +20,0 @@ var DefaultTransporter = require('./transporters.js'); |
{ | ||
"name": "googleapis", | ||
"version": "0.2.7-alpha", | ||
"version": "0.2.8-alpha", | ||
"author": "Google Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Google APIs Client Library for Node.js", |
49548
1056