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.12-alpha to 0.2.13-alpha

54

lib/requests.js

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

function BaseRequest(apiMeta) {

@@ -62,2 +61,23 @@ this.transporter = new DefaultTransporter();

/**
* Returns true if request requires a parameter.
* If no metadata is known about the request's method, true is returned.
* @return {boolean} Returns whether a parameter is required or not.
*/
BaseRequest.prototype.doesRequireParams = function() {
if (!this.apiMeta || !this.apiMeta.methods ||
!this.apiMeta.methods[this.methodName]) {
// nothing to do here, dont have enough
// info about the parameters
return true;
}
var methodMeta = this.apiMeta.methods[this.methodName];
for (var i in methodMeta.parameters) {
if (methodMeta.parameters[i].required) {
return true;
}
}
return false;
};
/**
* @protected

@@ -133,11 +153,19 @@ * Generates uri end-point with given params.

* @param {string} methodName Method name.
* @param {?object} params Parameters.
* @param {?object} opt_params Required Parameters. If none are required,
* expected to be not passed.
* @param {object=} opt_resource Optional resource.
*/
function Request(apiMeta, methodName, params, opt_resource) {
function Request(
apiMeta, methodName, opt_params, opt_resource) {
Request.super_.call(this);
this.apiMeta = apiMeta;
this.methodName = methodName;
this.params = params;
this.resource = opt_resource;
if (!this.doesRequireParams() && !opt_resource) {
this.params = {};
this.resource = opt_params;
} else {
this.params = opt_params || {};
this.resource = opt_resource;
}
}

@@ -155,2 +183,3 @@

Request.prototype.generatePayload = function() {
this.params.resource = this.resource;
var request = {

@@ -160,10 +189,5 @@ jsonrpc: BaseRequest.JSONRPC_VERSION,

method: this.methodName,
params: this.params || {},
params: this.params,
apiVersion: this.apiMeta.version
};
if (this.resource) {
request.params.resource = this.resource;
}
return [request];

@@ -222,12 +246,6 @@ };

BatchRequest.prototype.generatePayload = function() {
var payload = [];
for (var i = 0; i < this.requests_.length; i++) {
var request = this.requests_[i];
request.params = request.params || {};
if (request.resource) {
request.params.resource = request.resource;
}
request.params.resource = request.resource;
payload.push({

@@ -234,0 +252,0 @@ jsonrpc: BaseRequest.JSONRPC_VERSION,

{
"name": "googleapis",
"version": "0.2.12-alpha",
"version": "0.2.13-alpha",
"author": "Google Inc.",

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

"scripts": {
"test": "mocha tests/*"
"test": "mocha tests/* --reporter spec --timeout 40000"
},
"license": "Apache 2"
}

@@ -117,3 +117,3 @@ # google-api-nodejs-client [alpha]

var request2 =
client.urlshortener.url.insert(null, { longUrl: 'http://google.com' });
client.urlshortener.url.insert({ longUrl: 'http://google.com' });

@@ -120,0 +120,0 @@ // Create from client service using the raw action name

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