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
3
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 1.2.0 to 1.2.1

.snyk

2

lib/client/brand.js

@@ -25,3 +25,3 @@ //Brand.js: Client for the zendesk API.

Brand.prototype.show = function(brandId, cb) {
this.request('GET', ['brands'], cb);
this.request('GET', ['brands', brandId], cb);
};

@@ -28,0 +28,0 @@

@@ -67,3 +67,4 @@ // client.js - main client file that does most of the processing

useOAuth = this.options.get('oauth'),
token = this.options.get('token');
token = this.options.get('token'),
asUser = this.options.get('asUser');

@@ -83,2 +84,6 @@ url = assembleUrl(self, uri);

if(asUser){
self.options.headers['X-On-Behalf-Of'] = asUser;
}
if (useOAuth) {// token is an oauth token obtained from OAuth2

@@ -93,3 +98,5 @@ self.options.headers.Authorization = 'Bearer ' + token;

if (body) {
if ('GET' === method) {
self.options.body = undefined;
} else if (body) {
self.options.body = JSON.stringify(body);

@@ -113,3 +120,3 @@ } else if ('GET' !== method && 'application/json' === self.options.headers['Content-Type']) {

var args = Array.prototype.slice.call(arguments),
callback = args.pop(),
callbackOpt = args.pop(),
nextPage = 'Not Null!',

@@ -124,2 +131,15 @@ bodyList = [],

var errorCb, nextCb, completeCb;
if ( typeof callbackOpt === 'function' ) {
errorCb = callbackOpt;
nextCb = function () {};
completeCb = function (statusList, bodyList, responseList, resultList) {
callbackOpt(null, statusList, bodyList, responseList, resultList)
};
} else {
errorCb = callbackOpt.error;
nextCb = callbackOpt.next;
completeCb = callbackOpt.complete;
}
if ( throttle ) {

@@ -129,13 +149,18 @@ __request = throttler( this, Client.prototype.request, throttle );

function processPage(status, body, response, result) {
if(completeCb) { // only accumulate pages if a completeCb is provided
statusList.push(status);
bodyList.push(body);
responseList.push(response);
resultList.push(result);
}
nextPage = result ? result.next_page : null;
nextCb(status, body, response, result, nextPage);
}
return __request.apply(this, args.concat(function (error, status, body, response, result) {
if (error) {
return callback(error);
return errorCb(error);
}
statusList.push(status);
bodyList.push(body);
responseList.push(response);
resultList.push(result);
nextPage = result ? result.next_page : null;
processPage(status, body, response, result);
async.whilst(

@@ -155,8 +180,3 @@ function () {

}
statusList.push(status);
bodyList.push(body);
responseList.push(response);
resultList.push(result);
nextPage = result ? result.next_page : null;
processPage(status, body, response, result);
cb(null);

@@ -167,5 +187,5 @@ }]);

if (err) {
callback(err);
} else {
return callback(null, statusList, flatten(bodyList), responseList, resultList);
return errorCb(err);
} else if(completeCb) {
return completeCb(statusList, flatten(bodyList), responseList, resultList);
}

@@ -172,0 +192,0 @@ }

@@ -19,3 +19,3 @@ //

attempts = 0,
client = require('../client').createClient(options);
client = require('../client').createClient(options.stores.defaults.store);
nIntervId = setInterval(function getJobStatusUntilComplete() { getJobStatus(jobID); },( interval||500));

@@ -32,3 +32,5 @@

if(result["job_status"].status === "completed"){
if(result["job_status"].status === "completed" ||
result["job_status"].status === "failed" ||
result["job_status"].status === "killed") {
stopGetJobStatus();

@@ -35,0 +37,0 @@ console.log('Job '+id+' completed!');

@@ -30,2 +30,6 @@ //tickets.js: Client for the zendesk API.

Tickets.prototype.listAssigned = function (userID, cb) {
this.requestAll('GET', ['users', userID, 'tickets', 'assigned'], cb);//all?
};
Tickets.prototype.listByOrganization = function (orgID, cb) {

@@ -32,0 +36,0 @@ this.requestAll('GET', ['organizations', orgID, 'tickets'], cb);//all

{
"name": "node-zendesk",
"version": "1.2.0",
"version": "1.2.1",
"description": "zendesk API client wrapper",

@@ -62,8 +62,8 @@ "keywords": [

"dependencies": {
"request": "2.74.x",
"querystring": "0.2.x",
"async": "0.9.x",
"flatten": "0.0.x",
"nconf": "0.7.x"
"nconf": "0.7.x",
"querystring": "0.2.x",
"request": "^2.81.0"
}
}

@@ -82,3 +82,3 @@ # node-zendesk

They are fairly self-explanatory no-cookies, timeout, proxy, encoding are all options to request. if using debug its reccomended you use `--encoding utf8` or something similar as all you will see is a buffer otherwise in the response.
They are fairly self-explanatory no-cookies, timeout, proxy, encoding are all options to request. if using debug its recommended you use `--encoding utf8` or something similar as all you will see is a buffer otherwise in the response.

@@ -106,3 +106,3 @@ Because of these command line options you can try a few already from the examples section:

disableGlobalState: true,
debug: true // if you wan't to debug in library only mode, you'll have to include this
debug: true // if you want to debug in library only mode, you'll have to include this
});

@@ -122,2 +122,18 @@ ```

## Impersonation
See [Making API requests on behalf of end users ](https://help.zendesk.com/hc/en-us/articles/229488908) to grant impersonate scope. Pass end-user's email when creating client.
```js
var zendesk = require('node-zendesk');
var client = zendesk.createClient({
username: 'username',
token: 'oauth_token',
remoteUri: 'https://remote.zendesk.com/api/v2',
oauth: true,
asUser: 'end-user@example.com'
});
```
## client

@@ -131,2 +147,6 @@

## Pagination
When using the `requestAll` method, the client automatically pages-through results, accumulating all responses before returning them to the `cb` method. To monitor pagination, the `cb` parameter can also be an [observer](http://reactivex.io/rxjs/manual/overview.html#observer) – see [this example](examples/ticket-list-observer.js).
## Core API Methods

@@ -422,2 +442,3 @@ (See: https://developer.zendesk.com/rest_api/docs/core/introduction)

list(cb)
listAssigned(userID, cb)
listByOrganization(orgID, cb)

@@ -424,0 +445,0 @@ listByUserRequested(userID, cb)

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