From cfc37f99a6f6cef52e3c590d8ce4b74e7fd3a79c Mon Sep 17 00:00:00 2001 From: Marcelo Luiz Onhate Date: Thu, 1 Aug 2024 09:44:46 -0300 Subject: [PATCH] feat: tickets & users types + adjustments on types exports --- package.json | 30 ++++++++++++++++++++++++++++++ src/clients/core/tickets.js | 2 +- src/clients/core/users.js | 2 +- src/index.js | 1 + 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 443cee2e..f840b52e 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,36 @@ "types": "./dist/types/index.d.ts", "default": "./dist/index.js" } + }, + "./clients/*": { + "import": { + "types": "./dist/types/clients/*.d.ts", + "default": "./dist/clients/*.js" + }, + "require": { + "types": "./dist/types/clients/*.d.ts", + "default": "./dist/clients/*.js" + } + }, + "./clients/*/*": { + "import": { + "types": "./dist/types/clients/*/*.d.ts", + "default": "./dist/clients/*/*.js" + }, + "require": { + "types": "./dist/types/clients/*/*.d.ts", + "default": "./dist/clients/*/*.js" + } + }, + "./clients/*/*/*": { + "import": { + "types": "./dist/types/clients/*/*/*.d.ts", + "default": "./dist/clients/*/*/*.js" + }, + "require": { + "types": "./dist/types/clients/*/*/*.d.ts", + "default": "./dist/clients/*/*/*.js" + } } }, "files": [ diff --git a/src/clients/core/tickets.js b/src/clients/core/tickets.js index cbb4b473..3bb06634 100644 --- a/src/clients/core/tickets.js +++ b/src/clients/core/tickets.js @@ -348,7 +348,7 @@ class Tickets extends Client { * Update an existing ticket by its ID. * @param {number} ticketId - The ID of the ticket to update. * @param {CreateOrUpdateTicket} ticket - The updated ticket data as an object. - * @returns {Promise<{result: Ticket}>} A promise that resolves to the updated ticket object. + * @returns {Promise<{result: Ticket, response: {ticket:Ticket, audit:any[]}}>} A promise that resolves to the updated ticket object. * @async * @throws {Error} If `ticketId` is not a number or if `ticket` is not an object. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket} diff --git a/src/clients/core/users.js b/src/clients/core/users.js index 1759998d..b393333f 100644 --- a/src/clients/core/users.js +++ b/src/clients/core/users.js @@ -138,7 +138,7 @@ class Users extends Client { /** * Shows details of a user by ID. * @param {number} id - The ID of the user. - * @returns {Promise} The user's details. + * @returns {Promise<{result: User}>} The user's details. * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user} * @example diff --git a/src/index.js b/src/index.js index b2a0e2aa..fe065517 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,7 @@ const {ZendeskClientVoice} = require('./clients/voice'); /** * @typedef {object} ZendeskClientOptions * @property {string} [token] - Authentication token. + * @property {string} [password] - Authentication password. * @property {string} [username] - Username for authentication. * @property {string} [subdomain] - Subdomain for the Zendesk account (e.g., 'mycompany' for 'mycompany.zendesk.com'). If `endpointUri` is provided, this is ignored. * @property {string[]} [apiType=['core']] - Type of Zendesk API (e.g., 'core', 'helpcenter'). Determines the sub-client to use.