Git Product home page Git Product logo

Comments (6)

mackstann avatar mackstann commented on September 21, 2024 1

I'm seeing something similar with the TS types. I'm making a users.createOrUpdate call. The types say it returns a Promise<User>. But when the promise resolves, I don't have a User, I have a wrapper object with response and result properties. result is of type User.

Paste of the method declaration in 5.0.9 from my node_modules:

    /**
     * Creates or updates a user.
     * @param {object} user - The user details.
     * @returns {Promise<User>} The created or updated user's details.
     * @async
     * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#create-or-update-user}
     * @example
     * const user = await client.users.createOrUpdate({name: 'John Doe', email: '[email protected]'});
     */
    createOrUpdate(user: object): Promise<User>;

And the original JS declaration in the repo:

/**
* Creates or updates a user.
* @param {object} user - The user details.
* @returns {Promise<User>} The created or updated user's details.
* @async
* @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#create-or-update-user}
* @example
* const user = await client.users.createOrUpdate({name: 'John Doe', email: '[email protected]'});
*/
async createOrUpdate(user) {
return this.post(['users', 'create_or_update'], user);
}

Paste of the actual resolved value:

{
  response: {
    json: [Function: json],
    status: 201,
    headers: { get: [Function: get] },
    statusText: 'Created'
  },
  result: {
    id: ...,
    ... other User properties ...
  }
}

from node-zendesk.

binarypie avatar binarypie commented on September 21, 2024

I have the same issue with users.show where it expects to return a Promise<User> but the actual response value is Promise<{result: User}>

from node-zendesk.

jckw avatar jckw commented on September 21, 2024

I just contributed to the bounty on this issue.

Each contribution to this bounty has an expiry time and will be auto-refunded to the contributor if the issue is not solved before then.

Current bounty reward

To make this a public bounty or have a reward split, the maintainer can reply to this comment.

from node-zendesk.

owenshaupt avatar owenshaupt commented on September 21, 2024

ditto — exactly what @mackstann is seeing returned is also returning for me when using users.update

from node-zendesk.

andoshin11 avatar andoshin11 commented on September 21, 2024

any update on this?

from node-zendesk.

pano9000 avatar pano9000 commented on September 21, 2024

having the same issue with users.update.
If I recall correctly also similar thing with organizations.showMany was happening, where the types expect an array of numbers, while in reality it also seems to correctly accept a single number, not in an array.

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.