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

node-zendesk

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-zendesk - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

102

lib/client/client.js

@@ -11,3 +11,4 @@ //client.js

path = require('path'),
flatten = require('flatten');
flatten = require('flatten'),
pjson = require('./../../package.json');

@@ -17,2 +18,3 @@

this.options = options;
this.userAgent = 'node-zendesk/' + pjson.version + ' (node/' + process.versions.node + ')';
// Each client has its own cookies to isolate authentication between clients

@@ -48,3 +50,3 @@ this._request = request.defaults({

Client.prototype.request = function (method, uri) {
var options, params = '', last_element, url, self, res, args = Array.prototype.slice.call(arguments),
var options, params = '', last_element, url, self = this, res, args = Array.prototype.slice.call(arguments),
callback = args.pop(),

@@ -80,23 +82,22 @@ body = typeof args[args.length - 1] === 'object' && !Array.isArray(args[args.length - 1]) && args.pop(),

if(!options){
var headerObj = {
'Content-Type' : 'application/json',
var headerObj = { 'Content-Type' : 'application/json',
'Accept' : 'application/json',
'User-Agent' : 'node-zendesk/0.0.12 (node/' + process.versions.node + ')'
'User-Agent' : self.userAgent
};
if(useOAuth){ //token is an oauth token obtained from OAuth2
headerObj['Authorization'] = 'Bearer ' + token;
options = {
method: method || 'GET',
uri: url,
headers: headerObj
};
options = {
method: method || 'GET',
uri: url,
headers: headerObj
};
}
else //token is an API token obtained from the Zendesk Settings UI
{
headerObj['Authorization'] = 'Basic ' + encoded;
options = {
method: method || 'GET',
uri: url,
headers: headerObj
};
headerObj['Authorization'] = 'Basic ' + encoded;
options = {
method: method || 'GET',
uri: url,
headers: headerObj
};
}

@@ -124,4 +125,4 @@ }

var statusCode, error;
var statusCode, error, retryAfter;
if(!result){ //should this really be an error?

@@ -142,3 +143,3 @@ error = new Error('Zendesk returned an empty result');

var retryAfter = response.headers['Retry-After'];
retryAfter = response.headers['Retry-After'];
if (retryAfter) {

@@ -160,20 +161,20 @@ error = new Error('Zendesk rate limits 200 requests per minute');

if (res) {
if (!body && self.jsonAPIName !== null) {
body = res[(self.jsonAPIName.toString())];
}
if (!body && self.jsonAPIName2 !== null) {
body = res[(self.jsonAPIName2.toString())];
}
if (!body && self.jsonAPIName3 !== null) {
body = res[(self.jsonAPIName3.toString())];
}
if (!body) {
body = res;
}
if (!body && self.jsonAPIName !== null) {
body = res[(self.jsonAPIName.toString())];
}
if (!body && self.jsonAPIName2 !== null) {
body = res[(self.jsonAPIName2.toString())];
}
if (!body && self.jsonAPIName3 !== null) {
body = res[(self.jsonAPIName3.toString())];
}
if (!body) {
body = res;
}
}
else {
body = "";
body = "";
}
callback(null, statusCode, body, response, res);

@@ -234,3 +235,3 @@ });

Client.prototype.requestUpload = function (uri, file, fileToken, callback) {//TODO
var self = this,
var self = this,
out,

@@ -253,22 +254,21 @@ auth = this.options.get('password') ? ':' + this.options.get('password') : '/token:' + this.options.get('token'),

var headerObj = {
'Content-Type' : 'application/octet-stream',
var headerObj = { 'Content-Type' : 'application/octet-stream',
'Content-Length': stat.size,
'User-Agent' : 'node-zendesk/0.0.12 (node/' + process.versions.node + ')'
'User-Agent' : self.userAgent
};
if(useOAuth)
{
headerObj['Authorization'] = 'Bearer ' + token;
this.options = {
method: 'POST',
uri: self.options.get('remoteUri') + '/' + uri.join('/'),
headers: headerObj
};
headerObj['Authorization'] = 'Bearer ' + token;
this.options = {
method: 'POST',
uri: self.options.get('remoteUri') + '/' + uri.join('/'),
headers: headerObj
};
} else {
headerObj['Authorization'] = 'Basic ' + encoded;
this.options = {
method: 'POST',
uri: self.options.get('remoteUri') + '/' + uri.join('/'),
headers: headerObj
};
headerObj['Authorization'] = 'Basic ' + encoded;
this.options = {
method: 'POST',
uri: self.options.get('remoteUri') + '/' + uri.join('/'),
headers: headerObj
};
}

@@ -297,2 +297,3 @@

409: 'Conflict',
422: 'Unprocessable Entity', // zendesk sends this one back when you re-use an organization name
429: 'Too Many Requests',

@@ -302,2 +303,1 @@ 500: 'Internal Server Error',

};
{
"name": "node-zendesk",
"version": "0.0.12",
"version": "0.0.13",
"description": "zendesk API client wrapper",

@@ -5,0 +5,0 @@ "keywords": [

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