Git Product home page Git Product logo

Comments (9)

stormsa avatar stormsa commented on July 2, 2024

node-zendesk version : 2.0.0 or 2.1.0
@types/node-zendesk 2.0.6
zendesk documentation : https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user

from node-zendesk.

SamSokolin avatar SamSokolin commented on July 2, 2024

Also running into this issue!

from node-zendesk.

brendanmorrell avatar brendanmorrell commented on July 2, 2024

same issue on creating a ticket

from node-zendesk.

jase-k avatar jase-k commented on July 2, 2024

Running into this issue as well. If I modify the file: node_modules/node-zendesk/lib/client/client.js by commenting out / deleting lines 316-326 it works as expected with the types definition. (at least for the tickets api).

I'd prefer that the objects returned from the calls match the zendesk documentation (i.e. returning the parent object, rather than the child object).

Here is the commented out code that is causing the issue for reference of others dealing with this issue:
// if (self.jsonAPINames) {
// self.jsonAPINames.push("audit");
// self.jsonAPINames.push("via");
// for (var i = 0; i < self.jsonAPINames.length; i++) {
// if (res.hasOwnProperty(self.jsonAPINames[i].toString())) {
// body = res[self.jsonAPINames[i].toString()];
// break;
// }
// }
// }

from node-zendesk.

mralbean avatar mralbean commented on July 2, 2024

I'm facing the same issue.

I'm planning to use a similar solution to what @jase-k suggested, though wrap the node-zendesk client creation with my own function that will remove the jsonAPINames property from each of the APIs.

const createZendesk = (options: ClientOptions): zendesk.Client => {
  const client = zendesk.createClient(options)

  Object.keys(client).forEach((key) => {
    if (typeof client[key] === 'object' &&
      Object.prototype.hasOwnProperty.call(client[key], 'jsonAPINames')
    ) {
      delete client[key].jsonAPINames
    }
  })

  return client
}

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.