Git Product home page Git Product logo

Comments (2)

nnabuuu avatar nnabuuu commented on May 25, 2024

Looks like it's not implemented in node-zendesk yet. You are welcomed to contribute this Endpoint : )

I believe an /Optional/ parameter should be added for this function.

from node-zendesk.

baohouse avatar baohouse commented on May 25, 2024

Definitely not a trivial change to support optional parameters on the existing methods. Assuming you pass in sort options as an object:

{
  sort_by: 'created_at',
  sort_order: 'asc'
}

The methods would have to be updated, e.g. (and this is not the most elegant solution, but just something I quickly whipped up for my own project)

Tickets.prototype.listByUserRequested = function(userID) {
  var cb = arguments[arguments.length - 1]; // Last argument must always be callback
  var args = ['users', userID, 'tickets', 'requested'];
  if (typeof arguments[1] === 'object') { args.push(arguments[1]); }
  this.requestAll('GET', args, cb);
};

Another problem is which of these methods should get the optional parameter support, because according to Zendesk

Some lists can be ordered by transmitting a sort_order=desc or sort_order=asc parameter to the end point. Whether a specific list can be ordered is specified in the documentation for that specific resource.

I've observed some resources like Ticket Comments mentioning nothing about supporting sorting, and yet when I did some testing, it did work. So I'd hate to have to rely on evolving documentation and selectively choose which methods should support optional sort parameters.

from node-zendesk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.