From 2cfe5dc77fe202e282badc5e53865af3359473ed Mon Sep 17 00:00:00 2001 From: Farrin Reid Date: Thu, 1 Aug 2024 17:22:29 -0700 Subject: [PATCH] chore: upgrade typedoc and fix all warnings --- examples/create-oauth-token.js | 2 - package.json | 4 +- src/clients/client.js | 23 +++---- src/clients/core/accountsettings.js | 3 - src/clients/core/activitystream.js | 5 -- src/clients/core/attachments.js | 6 -- src/clients/core/automations.js | 11 ---- src/clients/core/brand.js | 7 --- src/clients/core/customagentroles.js | 8 +-- src/clients/core/dynamiccontent.js | 7 --- src/clients/core/dynamiccontentvariants.js | 7 --- src/clients/core/groupmemberships.js | 14 ----- src/clients/core/groups.js | 27 ++++---- src/clients/core/imports.js | 2 - src/clients/core/installations.js | 5 -- src/clients/core/jobstatuses.js | 4 -- src/clients/core/locales.js | 10 +-- src/clients/core/macros.js | 12 ---- src/clients/core/oauthclients.js | 6 -- src/clients/core/oauthtokens.js | 5 -- src/clients/core/organizationfields.js | 6 -- src/clients/core/organizationmemberships.js | 12 ---- src/clients/core/organizations.js | 68 +++++++-------------- src/clients/core/permissiongroups.js | 5 -- src/clients/core/policies.js | 7 --- src/clients/core/requests.js | 13 ---- src/clients/core/satisfactionratings.js | 5 -- src/clients/core/search.js | 6 -- src/clients/core/sessions.js | 7 --- src/clients/core/sharingagreement.js | 5 -- src/clients/core/sideconversations.js | 6 -- src/clients/core/suspendedtickets.js | 13 +--- src/clients/core/tags.js | 5 -- src/clients/core/targetfailures.js | 2 - src/clients/core/targets.js | 5 -- src/clients/core/ticketaudits.js | 5 -- src/clients/core/ticketevents.js | 3 - src/clients/core/ticketexport.js | 6 -- src/clients/core/ticketfields.js | 11 ---- src/clients/core/ticketforms.js | 10 +-- src/clients/core/ticketimport.js | 18 +++--- src/clients/core/ticketmetrics.js | 3 - src/clients/core/tickets.js | 36 ++--------- src/clients/core/triggers.js | 13 ---- src/clients/core/userfields.js | 10 --- src/clients/core/useridentities.js | 8 --- src/clients/core/users.js | 28 --------- src/clients/core/views.js | 17 ------ src/clients/core/webhooks.js | 11 ---- src/clients/helpcenter/index.js | 4 +- src/clients/services/index.js | 7 ++- src/clients/throttle.js | 12 ++-- src/clients/voice/index.js | 4 +- src/index.js | 20 +++--- 54 files changed, 90 insertions(+), 469 deletions(-) diff --git a/examples/create-oauth-token.js b/examples/create-oauth-token.js index 1600d862..f6fc2806 100644 --- a/examples/create-oauth-token.js +++ b/examples/create-oauth-token.js @@ -24,7 +24,6 @@ const setupClient = (config) => { * Retrieves the numeric ID of an OAuth client based on its unique identifier. * @param {string} identifier - The unique identifier of the OAuth client. * @returns {Promise} The numeric ID of the OAuth client or null if not found. - * @async * @throws {Error} If there's an error in retrieving the OAuth client list. */ async function getClientId(identifier) { @@ -43,7 +42,6 @@ async function getClientId(identifier) { * Creates a read-only OAuth token for accessing users and tickets. * This function first retrieves the OAuth client ID using its unique identifier, * and then uses this ID to create a token with the specified scopes. - * @async * @throws {Error} If the OAuth client ID is not found or if there's an error in creating the OAuth token. */ async function createReadOnlyOAuthToken() { diff --git a/package.json b/package.json index dddce1cb..ffd387d2 100644 --- a/package.json +++ b/package.json @@ -155,8 +155,8 @@ "dotenv": "^16.4.0", "eslint-plugin-jsdoc": "^48.0.2", "nock": "^13.5.0", - "typedoc": "^0.25.7", - "typedoc-plugin-markdown": "^3.17.1", + "typedoc": "^0.26.5", + "typedoc-plugin-markdown": "^4.2.3", "vitepress": "1.3.1", "vitepress-sidebar": "1.24.1", "vitest": "^1.2.1", diff --git a/src/clients/client.js b/src/clients/client.js index 559542cf..ce50fdf3 100644 --- a/src/clients/client.js +++ b/src/clients/client.js @@ -12,19 +12,14 @@ const { } = require('./helpers'); /** - * @typedef {object} ClientOptions - * @property {string} subdomain - Subdomain for the Zendesk instance. - * @property {string} [password] - Password for authentication. - * @property {string} [token] - Token for authentication. - * @property {boolean} [useOAuth] - Flag to indicate if OAuth is used. - * @property {string} [username] - Username for authentication. - * @property {string} [asUser] - Optional header for making requests on behalf of a user. - * @property {object} [customHeaders] - Any additional custom headers for the request. - * @property {boolean} [throttle] - Flag to enable throttling of requests. - * @property {boolean} [throwOriginalException] - Throw the original exception when API requests fail. - * @property {CustomEventTarget} eventTarget - Event target to handle custom events. - * @property {Array} sideLoad - Array to handle side-loaded resources. - * @property {Array} jsonAPINames - Array to hold names used in the JSON API. + * @typedef {import('../index').ZendeskClientOptions} ZendeskClientOptions + */ + +/** + * @typedef {ZendeskClientOptions} ClientOptions + * + * This type extends `ZendeskClientOptions` to be used for configuring the Client instance. + * All properties of `ZendeskClientOptions` are available here. */ /** @@ -33,7 +28,6 @@ const { * @class * @property {ClientOptions} options - Configuration options for the client. * @property {Array} sideLoad - Array to handle side-loaded resources. - * @property {string} userAgent - User agent for the client. * @property {Array} jsonAPINames - Array to hold names used in the JSON API. * @property {boolean} useDotJson - Flag to indicate if the API endpoint should use '.json' ending. * @property {ApiTypes} apiType - Type of Zendesk API to initialize (e.g., 'core', 'helpcenter'). @@ -42,7 +36,6 @@ const { */ class Client { /** - * @constructs Client * @param {ClientOptions} options - Configuration options for the client. * @param {ApiTypes} apiType - Type of Zendesk API to initialize (e.g., 'core', 'helpcenter'). */ diff --git a/src/clients/core/accountsettings.js b/src/clients/core/accountsettings.js index 5de7f91d..9438f899 100644 --- a/src/clients/core/accountsettings.js +++ b/src/clients/core/accountsettings.js @@ -5,7 +5,6 @@ const {Client} = require('../client'); /** * The AccountSettings class provides methods for interacting with account settings in the Zendesk JSON API. * {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/account_settings/ | See the Zendesk API documentation for more details}. - * @augments Client */ class AccountSettings extends Client { constructor(options) { @@ -17,7 +16,6 @@ class AccountSettings extends Client { * Retrieves the account settings. * @returns {Promise} A promise that resolves to the account settings. * {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/account_settings/#show-settings | See the Zendesk API documentation for more details}. - * @async * @example * const settings = await client.accountsettings.show(); */ @@ -30,7 +28,6 @@ class AccountSettings extends Client { * @param {object} settings - The settings to update. * @returns {Promise} A promise that resolves to the updated account settings. * {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/account_settings/#update-account-settings | See the Zendesk API documentation for more details}. - * @async * @example * const settings = await client.accountsettings.update({ "settings": { "active_features": { "customer_satisfaction": false }}}); */ diff --git a/src/clients/core/activitystream.js b/src/clients/core/activitystream.js index ec64f986..53423881 100644 --- a/src/clients/core/activitystream.js +++ b/src/clients/core/activitystream.js @@ -5,8 +5,6 @@ const {Client} = require('../client'); /** * `ActivityStream` provides methods to interact with Zendesk ticket activities. * This class extends the base Client class and is tailored to fetch activity data. - * @class - * @augments {Client} * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/activity_stream/ | Zendesk Activity Stream API} * @example * const client = new Client({ /* ...options... * / }); @@ -25,7 +23,6 @@ class ActivityStream extends Client { /** * Lists all ticket activities from the Zendesk API. * @returns {Array} An array of activity objects. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/activity_stream/#list-activities | Zendesk API - List Activities} * @example * const activities = await client.activitystream.list(); @@ -38,7 +35,6 @@ class ActivityStream extends Client { * Retrieves a specific ticket activity by its ID. * @param {number} activityID - The unique ID of the activity to fetch. * @returns {Promise} A promise that resolves to the activity object corresponding to the provided activityID. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/activity_stream/#show-activity | Zendesk API - Show Activity} * @example * const activity = await client.activitystream.show(12345); // Where 12345 is an activity ID. @@ -55,7 +51,6 @@ class ActivityStream extends Client { * Note: When the count exceeds 100,000, count[refreshed_at] may occasionally be null. This indicates * that the count is being updated in the background, and count[value] is limited to 100,000 until the update is complete. * @returns {Promise} A promise that resolves to an object containing the activity count and the refreshed_at timestamp. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/activity_stream/#count-activities | Zendesk API - Count Activities} * @example * const activityCount = await client.activitystream.count(); diff --git a/src/clients/core/attachments.js b/src/clients/core/attachments.js index 751c2bfb..4dd82da4 100644 --- a/src/clients/core/attachments.js +++ b/src/clients/core/attachments.js @@ -3,7 +3,6 @@ const {Client} = require('../client'); /** * Represents the Attachments functionality of the Zendesk API. - * @augments {Client} * @see [Zendesk Attachments API]{@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/} */ class Attachments extends Client { @@ -19,7 +18,6 @@ class Attachments extends Client { * @param {boolean} fileOptions.binary - If the file is binary or not. * @param {string} [fileOptions.token] - Token received from previous uploads (if multiple files are being attached). * @returns {Promise} Returns the server's response. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#upload-files} * @example * const response = await client.attachments.upload(fileBuffer, { filename: "example.png", binary: true }); @@ -49,7 +47,6 @@ class Attachments extends Client { * Delete an uploaded file. * @param {string} token - The token of the uploaded attachment. * @returns {Promise} Returns the server's response. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#delete-upload} * @example * const response = await client.attachments.deleteUpload("exampleToken"); @@ -62,7 +59,6 @@ class Attachments extends Client { * Retrieve details of a specific attachment. * @param {number} attachmentID - The ID of the attachment. * @returns {Promise} Returns the details of the attachment. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#show-attachment} * @example * const attachmentDetails = await client.attachments.show(12345); @@ -77,7 +73,6 @@ class Attachments extends Client { * @param {number} commentID - The ID of the comment. * @param {number} attachmentID - The ID of the attachment. * @returns {Promise} Returns the server's response. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#redact-comment-attachment} * @example * const response = await client.attachments.redactAttachmentComment(1, 2, 3); @@ -102,7 +97,6 @@ class Attachments extends Client { * @param {number} attachmentID - The ID of the attachment. * @param {boolean} malwareAccessOverride - Whether to override malware access. If true, agent can access attachment flagged as malware. * @returns {Promise} The response from the Zendesk API. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#update-attachment-for-malware} * @example diff --git a/src/clients/core/automations.js b/src/clients/core/automations.js index 4c979804..298fa779 100644 --- a/src/clients/core/automations.js +++ b/src/clients/core/automations.js @@ -8,7 +8,6 @@ const {Client} = require('../client'); /** * The Automations class provides methods for interacting with the Zendesk Automation API. * {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/| See the Zendesk API documentation for more details}. - * @augments Client */ class Automations extends Client { constructor(options) { @@ -19,7 +18,6 @@ class Automations extends Client { /** * List all automations. * @returns {Promise} Returns a list of automations. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#list-automations} * @example const automations = await client.automations.list(); */ @@ -30,7 +28,6 @@ class Automations extends Client { /** * List all active automations. * @returns {Promise} Returns a list of active automations. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#list-active-automations} * @example const activeAutomations = await client.automations.listActive(); */ @@ -42,7 +39,6 @@ class Automations extends Client { * Get details of a specific automation by ID. * @param {number} automationID - The ID of the automation. * @returns {Promise} Returns details of the automation. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#show-automation} * @example const automationDetails = await client.automations.show(123456); */ @@ -54,7 +50,6 @@ class Automations extends Client { * Create a new automation. * @param {object} automationData - Data for the new automation. * @returns {Promise} Returns the created automation. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#create-automation} * @example * const automation = await client.automations.create({ @@ -72,7 +67,6 @@ class Automations extends Client { * @param {number} automationID - ID of the automation to update. * @param {object} updatedData - Updated data for the automation. * @returns {Promise} Returns the updated automation. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#update-automation} * @example * const updatedAutomation = await client.automations.update(12345, { @@ -87,7 +81,6 @@ class Automations extends Client { * Update many automations in bulk. * @param {Array} automations - Array of automation data with their IDs to be updated. * @returns {Promise} Returns the status of the bulk update. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#update-many-automation} * @example * const status = await client.automations.updateMany([{id: 123, position: 1}, {id: 124, position: 2}]); @@ -100,7 +93,6 @@ class Automations extends Client { * Delete an automation. * @param {number} automationID - ID of the automation to be deleted. * @returns {Promise} - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#delete-automation} * @example * await client.automations.delete(12345); @@ -113,7 +105,6 @@ class Automations extends Client { * Bulk delete automations. * @param {Array} ids - Array of automation IDs to be deleted. * @returns {Promise} - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#bulk-delete-automation} * @example * await client.automations.bulkDelete([12345, 67890]); @@ -126,7 +117,6 @@ class Automations extends Client { * Search automations by with query. * @param {object} searchQuery - The parameters to search for ['active', 'include', 'query', 'sort_by', 'sort_order']. * @returns {Promise} Returns automations matching the search query. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#search-automation} * @example const foundAutomations = await client.automations.search('close'); */ @@ -138,7 +128,6 @@ class Automations extends Client { * Reorder the list of automations. * @param {Array} automationIDs - Array of automation IDs in the desired order. * @returns {Promise} Returns the status of the reorder. - * @async * @example * const status = await client.automations.reorder([67890, 12345]); * @deprecated This may now be deprecated, please notify developers if you find this to be the case. diff --git a/src/clients/core/brand.js b/src/clients/core/brand.js index e017c6d0..76c757d5 100644 --- a/src/clients/core/brand.js +++ b/src/clients/core/brand.js @@ -13,7 +13,6 @@ class Brand extends Client { /** * List all brands. * @returns {Promise} The list of brands. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#list-brands} * @example const brands = await client.brands.list(); */ @@ -25,7 +24,6 @@ class Brand extends Client { * Show a specific brand by ID. * @param {number} brandId - The ID of the brand. * @returns {Promise} The brand details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#show-a-brand} * @example const brand = await client.brands.show(47); */ @@ -37,7 +35,6 @@ class Brand extends Client { * Create a new brand. * @param {object} brand - The brand data. * @returns {Promise} The created brand details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#create-brand} * @example const newBrand = await client.brands.create({name: "Brand 1", subdomain: "Brand1"}); */ @@ -50,7 +47,6 @@ class Brand extends Client { * @param {object} brand - The updated brand data. * @param {number} brandId - The ID of the brand to update. * @returns {Promise} The updated brand details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#update-a-brand} * @example const updatedBrand = await client.brands.update({name: "Updated Brand"}, 47); */ @@ -62,7 +58,6 @@ class Brand extends Client { * Delete a brand. * @param {number} brandId - The ID of the brand to delete. * @returns {Promise} The deletion status. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#delete-a-brand} * @example await client.brands.delete(47); */ @@ -75,7 +70,6 @@ class Brand extends Client { * @param {string} hostMapping - The host mapping to check. * @param {string} subdomain - The subdomain to check. * @returns {Promise} The check result. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#check-host-mapping-validity} * @example await client.brands.checkHostMapping("brand1.com", "brand1"); */ @@ -91,7 +85,6 @@ class Brand extends Client { * Check host mapping validity for an existing brand. * @param {number} brandId - The ID of the brand to check. * @returns {Promise} The check result. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#check-host-mapping-validity-for-an-existing-brand} * @example await client.brands.checkHostMappingForExistingBrand(47); */ diff --git a/src/clients/core/customagentroles.js b/src/clients/core/customagentroles.js index b6f359ad..97a03996 100644 --- a/src/clients/core/customagentroles.js +++ b/src/clients/core/customagentroles.js @@ -2,8 +2,7 @@ const {Client} = require('../client'); /** - * @class - * @classdesc Client for Zendesk's Custom Agent Roles API. + * Client for Zendesk's Custom Agent Roles API. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/} */ class CustomAgentRoles extends Client { @@ -15,7 +14,6 @@ class CustomAgentRoles extends Client { /** * List all Custom Agent Roles. * @returns {Promise} Returns a promise that resolves with the list of custom agent roles. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#list-custom-roles} * @example * const client = createClient({...}); @@ -29,7 +27,6 @@ class CustomAgentRoles extends Client { * Retrieve a specific Custom Agent Role by its ID. * @param {number} roleId The ID of the custom agent role to retrieve. * @returns {Promise} Returns a promise that resolves with the specified custom agent role. - * @async * @throws Will throw an error if unable to retrieve the role. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#show-custom-role} * @example @@ -44,7 +41,6 @@ class CustomAgentRoles extends Client { * Creates a new custom agent role. * @param {object} roleData - The data for the new custom agent role. * @returns {Promise} The created custom agent role. - * @async * @throws Will throw an error if creation fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#create-custom-role} * @example @@ -64,7 +60,6 @@ class CustomAgentRoles extends Client { * @param {number} customRoleId - The ID of the custom agent role to update. * @param {object} updatedData - The updated data for the custom agent role. * @returns {Promise} The updated custom agent role. - * @async * @throws Will throw an error if the update fails or custom agent role ID is not found. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#update-custom-role} * @example @@ -79,7 +74,6 @@ class CustomAgentRoles extends Client { * Delete a specific Custom Agent Role by its ID. * @param {number} roleId The ID of the custom agent role to delete. * @returns {Promise} Returns a promise that resolves when the role is deleted. - * @async * @throws Will throw an error if unable to delete the role. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#delete-custom-role} * @example diff --git a/src/clients/core/dynamiccontent.js b/src/clients/core/dynamiccontent.js index c9324882..9e8edbbd 100644 --- a/src/clients/core/dynamiccontent.js +++ b/src/clients/core/dynamiccontent.js @@ -18,7 +18,6 @@ class DynamicContent extends Client { /** * Lists the dynamic content items. * @returns {Promise} The dynamic content items. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#list-items} * @example const items = await client.dynamiccontent.listItems(); @@ -30,7 +29,6 @@ class DynamicContent extends Client { /** * Lists all dynamic content items. * @returns {Promise} All the dynamic content items. - * @async * @throws {Error} Throws an error if the request fails. * @example const allItems = await client.dynamiccontent.listAllItems(); */ @@ -42,7 +40,6 @@ class DynamicContent extends Client { * Shows a specific dynamic content item. * @param {number} itemID - The ID of the dynamic content item. * @returns {Promise} The specified dynamic content item. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#show-item} * @example const item = await client.dynamiccontent.showItem(12345); @@ -55,7 +52,6 @@ class DynamicContent extends Client { * Retrieves multiple dynamic content items using their identifiers. * @param {string[]} identifiers - An array of identifiers for the dynamic content items. * @returns {Promise} Returns the fetched dynamic content items. - * @async * @throws {Error} Throws an error if the provided identifiers parameter is not a valid array or is empty. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#show-many-items} * @example @@ -73,7 +69,6 @@ class DynamicContent extends Client { * Creates a new dynamic content item. * @param {object} item - The item to create. * @returns {Promise} The created dynamic content item. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#create-item} * @example const newItem = await client.dynamiccontent.createItem({name: "Sample Item", default_locale_id: 1, variants: [...]}); @@ -87,7 +82,6 @@ class DynamicContent extends Client { * @param {number} itemID - The ID of the dynamic content item. * @param {object} item - The updated item details. * @returns {Promise} The updated dynamic content item. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#update-item} * @example const updatedItem = await client.dynamiccontent.updateItem(12345, {name: "Updated Name"}); @@ -100,7 +94,6 @@ class DynamicContent extends Client { * Deletes a specific dynamic content item. * @param {number} itemID - The ID of the dynamic content item. * @returns {Promise} The response after deletion. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#delete-item} * @example await client.dynamiccontent.deleteItem(12345); diff --git a/src/clients/core/dynamiccontentvariants.js b/src/clients/core/dynamiccontentvariants.js index 3e5767c2..8a1243a9 100644 --- a/src/clients/core/dynamiccontentvariants.js +++ b/src/clients/core/dynamiccontentvariants.js @@ -17,7 +17,6 @@ class DynamicContentVariants extends Client { * Lists all variants of a specified dynamic content item. * @param {number} itemID - The ID of the dynamic content item. * @returns {Promise} The variants of the specified content item. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#list-variants} * @example @@ -32,7 +31,6 @@ class DynamicContentVariants extends Client { * @param {number} itemID - The ID of the dynamic content item. * @param {number} variantID - The ID of the variant to fetch. * @returns {Promise} Returns the dynamic content variant details. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#show-variant} * @example @@ -54,7 +52,6 @@ class DynamicContentVariants extends Client { * @param {number} itemID - The ID of the dynamic content item. * @param {object} variant - The details of the variant to create. * @returns {Promise} Returns the details of the created variant. - * @async * @throws {Error} Throws an error if the API call fails or if a locale variant already exists. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#create-variant} * @example @@ -77,7 +74,6 @@ class DynamicContentVariants extends Client { * @param {number} variantID - The ID of the variant to update. * @param {object} variant - The updated details of the variant. * @returns {Promise} Returns the details of the updated variant. - * @async * @throws {Error} Throws an error if the API call fails or if you try to switch the active state of the default variant. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#update-variant} * @example @@ -101,7 +97,6 @@ class DynamicContentVariants extends Client { * @param {number} itemID - The ID of the dynamic content item. * @param {number} variantID - The ID of the variant to delete. * @returns {Promise} A confirmation of the deletion. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#delete-variant} * @example @@ -122,7 +117,6 @@ class DynamicContentVariants extends Client { * @param {number} itemID - The ID of the dynamic content item. * @param {object[]} variants - Array of variant objects to be created. * @returns {Promise} A confirmation of the creation. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#create-many-variants} * @example @@ -140,7 +134,6 @@ class DynamicContentVariants extends Client { * @param {number} itemID - The ID of the dynamic content item. * @param {object[]} variants - Array of variant objects to be updated. * @returns {Promise} A confirmation of the update. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#update-many-variants} * @example diff --git a/src/clients/core/groupmemberships.js b/src/clients/core/groupmemberships.js index 8dd1235a..2601f227 100644 --- a/src/clients/core/groupmemberships.js +++ b/src/clients/core/groupmemberships.js @@ -18,7 +18,6 @@ class GroupMemberships extends Client { /** * List all group memberships. * @returns {Promise} Array of group memberships. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-memberships} * @example * const memberships = await client.groupmemberships.list(); @@ -31,7 +30,6 @@ class GroupMemberships extends Client { * List group memberships by user ID. * @param {number} userID - The ID of the user. * @returns {Promise} Array of group memberships. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-memberships} * @example * const memberships = await client.groupmemberships.listByUser(123); @@ -44,7 +42,6 @@ class GroupMemberships extends Client { * List group memberships by group ID. * @param {number} groupID - The ID of the group. * @returns {Promise} Array of group memberships. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-memberships} * @example * const memberships = await client.groupmemberships.listByGroup(123); @@ -59,7 +56,6 @@ class GroupMemberships extends Client { * Show details of a specific group membership. * @param {number} groupMembershipID - The ID of the group membership. * @returns {Promise} Details of the group membership. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#show-membership} * @example * const membershipDetails = await client.groupmemberships.show(123); @@ -73,7 +69,6 @@ class GroupMemberships extends Client { * @param {number} userID - The ID of the user. * @param {number} groupMembershipID - The ID of the group membership. * @returns {Promise} Details of the group membership. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#show-membership} * @example * const membershipDetails = await client.groupmemberships.showByUser(123, 456); @@ -86,7 +81,6 @@ class GroupMemberships extends Client { * Create a new group membership. * @param {object} groupMembership - The group membership details. * @returns {Promise} The created group membership. - * @async * @throws {Error} Throws an error if the creation fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#create-membership} * @example @@ -101,7 +95,6 @@ class GroupMemberships extends Client { * @param {number} userID - The ID of the user. * @param {object} groupMembership - The group membership details. * @returns {Promise} The created group membership. - * @async * @throws {Error} Throws an error if the creation fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#create-membership} * @example @@ -115,7 +108,6 @@ class GroupMemberships extends Client { * Delete a group membership. * @param {number} groupMembershipID - The ID of the group membership. * @returns {Promise} - * @async * @throws {Error} Throws an error if the deletion fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#delete-membership} * @example @@ -130,7 +122,6 @@ class GroupMemberships extends Client { * @param {number} userID - The ID of the user. * @param {number} groupMembershipID - The ID of the group membership. * @returns {Promise} - * @async * @throws {Error} Throws an error if the deletion fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#delete-membership} * @example @@ -150,7 +141,6 @@ class GroupMemberships extends Client { * @param {number} userID - The ID of the user. * @param {number} groupMembershipID - The ID of the group membership. * @returns {Promise} Updated group membership. - * @async * @throws {Error} Throws an error if the operation fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#set-membership-as-default} * @example @@ -169,7 +159,6 @@ class GroupMemberships extends Client { /** * List all assignable group memberships. * @returns {Promise} List of assignable group memberships. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-assignable-memberships} * @example @@ -183,7 +172,6 @@ class GroupMemberships extends Client { * List all assignable group memberships by group. * @param {number} groupID - The ID of the group. * @returns {Promise} List of assignable group memberships for the specified group. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-assignable-memberships} * @example @@ -197,7 +185,6 @@ class GroupMemberships extends Client { * Bulk create group memberships. * @param {Array} groupMemberships - Array of group memberships to be created. * @returns {Promise} Job status indicating the progress of the bulk create operation. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#bulk-create-memberships} * @example @@ -213,7 +200,6 @@ class GroupMemberships extends Client { * Bulk delete group memberships. * @param {Array} ids - Array of group membership IDs to be deleted. * @returns {Promise} Response object indicating the result of the bulk delete operation. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#bulk-delete-memberships} * @example diff --git a/src/clients/core/groups.js b/src/clients/core/groups.js index 722e8cbb..e2eebc43 100644 --- a/src/clients/core/groups.js +++ b/src/clients/core/groups.js @@ -2,27 +2,30 @@ const {Client} = require('../client'); /** - * @typedef {object} RecursivePartial + * A recursive type that makes all properties of an object optional, including nested objects. * @template T - * @property {T[P]} [P] - The property of the object. + * @typedef {object} RecursivePartial + * @property {Partial<{[K in keyof T]: RecursivePartial}>} [key] - A recursive partial property of T. */ /** + * Represents a group within Zendesk. * @typedef {object} Group - * @property {string} created_at - The time the group was created - * @property {boolean} default - If the group is the default one for the account - * @property {boolean} deleted - Deleted groups get marked as such - * @property {string} [description] - The description of the group - * @property {number} id - Automatically assigned when creating groups - * @property {boolean} [is_public] - If true, the group is public. If false, the group is private. You can't change a private group to a public group - * @property {string} name - The name of the group - * @property {string} updated_at - The time of the last update of the group - * @property {string} url - The API url of the group + * @property {string} created_at - The time the group was created. + * @property {boolean} default - If the group is the default one for the account. + * @property {boolean} deleted - Deleted groups get marked as such. + * @property {string} [description] - The description of the group. + * @property {number} id - Automatically assigned when creating groups. + * @property {boolean} [is_public] - If true, the group is public. If false, the group is private. You can't change a private group to a public group. + * @property {string} name - The name of the group. + * @property {string} updated_at - The time of the last update of the group. + * @property {string} url - The API URL of the group. */ /** + * Represents the data structure to create or update a group. * @typedef {object} CreateOrUpdateGroup - * @property {RecursivePartial} group - The group to create or update + * @property {RecursivePartial} group - The group to create or update. */ /** diff --git a/src/clients/core/imports.js b/src/clients/core/imports.js index e946ce8c..573ee041 100644 --- a/src/clients/core/imports.js +++ b/src/clients/core/imports.js @@ -15,7 +15,6 @@ class Imports extends Client { * Imports a single ticket to Zendesk. * @param {object} ticket - The ticket data to be imported. * @returns {Promise} The response from the Zendesk API. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/#ticket-import} * @example @@ -42,7 +41,6 @@ class Imports extends Client { * Imports multiple tickets to Zendesk in bulk. * @param {object[]} tickets - An array of ticket data to be imported. * @returns {Promise} The response from the Zendesk API. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/#ticket-bulk-import} * @example diff --git a/src/clients/core/installations.js b/src/clients/core/installations.js index d0c436f7..c84fcbc3 100644 --- a/src/clients/core/installations.js +++ b/src/clients/core/installations.js @@ -10,7 +10,6 @@ class Installations extends Client { /** * List all app installations in the account. * @returns {Promise>} An array of app installation objects. - * @async * @throws {Error} Throws an error if the API call is unsuccessful. * @see {@link https://developer.zendesk.com/api-reference/ticketing/apps/apps/#list-app-installations} * @example @@ -25,7 +24,6 @@ class Installations extends Client { * Retrieve details of a specific app installation by its ID. * @param {number|string} installationID - The unique identifier for the app installation. * @returns {Promise} The app installation details as an object. - * @async * @throws {Error} Throws an error if the API call is unsuccessful or the installationID is invalid. * @see {@link https://developer.zendesk.com/api-reference/ticketing/apps/apps/#show-app-installation} * @example @@ -40,7 +38,6 @@ class Installations extends Client { * Create a new app installation. * @param {object} installation - The app installation data to be created. * @returns {Promise} The response data from creating the app installation. - * @async * @throws {Error} Throws an error if the API call is unsuccessful or if the installation data is invalid. * @see {@link https://developer.zendesk.com/api-reference/ticketing/apps/apps/#install-app} For more details about creating an installation. * @example @@ -61,7 +58,6 @@ class Installations extends Client { * @param {number} installationID - The ID of the app installation. * @param {object} installation - The updated installation data. * @returns {Promise} Returns the response from Zendesk API. - * @async * @throws {Error} Throws an error if the API call is unsuccessful. * @see {@link https://developer.zendesk.com/api-reference/ticketing/apps/apps/#update-app-installation} * @example @@ -82,7 +78,6 @@ class Installations extends Client { * Removes a specific app installation. * @param {number} installationID - The ID of the app installation. * @returns {Promise} Returns the response from Zendesk API. - * @async * @throws {Error} Throws an error if the API call is unsuccessful. * @see {@link https://developer.zendesk.com/api-reference/ticketing/apps/apps/#remove-app-installation} * @example diff --git a/src/clients/core/jobstatuses.js b/src/clients/core/jobstatuses.js index 60dd6f21..9e49bc45 100644 --- a/src/clients/core/jobstatuses.js +++ b/src/clients/core/jobstatuses.js @@ -16,7 +16,6 @@ class JobStatuses extends Client { /** * Retrieves a list of job statuses. * @returns {Promise>} - A promise that resolves to a list of job statuses. - * @async * @throws {Error} If there's an error in the request. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/job_statuses/#list-job-statuses} for the API endpoint documentation. * @example @@ -30,7 +29,6 @@ class JobStatuses extends Client { * Retrieves the status of a background job. * @param {string} jobStatusID - The ID of the Job status. * @returns {Promise} - A promise that resolves to the job status data. - * @async * @throws {Error} If the job status ID is not provided or if there's an error in the request. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/job_statuses/#show-job-status} for the API endpoint documentation. * @example @@ -44,7 +42,6 @@ class JobStatuses extends Client { * Retrieves the statuses of multiple background jobs. * @param {Array} jobStatusIDs - An array of job status IDs. * @returns {Promise>} - A promise that resolves to a list of job statuses. - * @async * @throws {Error} If the job status IDs are not provided or if there's an error in the request. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/job_statuses/#show-many-job-statuses} for the API endpoint documentation. * @example @@ -70,7 +67,6 @@ class JobStatuses extends Client { * @param {number} interval - The time (in milliseconds) to wait between each check. * @param {number} maxAttempts - The maximum number of attempts to check the job status. * @returns {Promise} - A promise that resolves with the job status when the job is completed or the maximum attempts are reached. - * @async * @throws {Error} If there's an error in the request or if the maximum attempts are reached without the job completing. * @example * await client.jobstatuses.watch("dd9321f29967688b27bc9499ebb4ae8d", 1000, 5); diff --git a/src/clients/core/locales.js b/src/clients/core/locales.js index 89c153e3..f2d5f3a3 100644 --- a/src/clients/core/locales.js +++ b/src/clients/core/locales.js @@ -2,8 +2,7 @@ const {Client} = require('../client'); /** - * @class - * @description Represents the Locales endpoint of the Zendesk REST API wrapper. + * Represents the Locales endpoint of the Zendesk REST API wrapper. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/} */ class Locales extends Client { @@ -15,7 +14,6 @@ class Locales extends Client { /** * Lists all the translation locales available for the account. * @returns {Promise} List of locales. - * @async * @throws {Error} Throws an error if the API request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#list-locales} * @example @@ -30,7 +28,6 @@ class Locales extends Client { * Retrieves information about a specific locale based on the localeID. * @param {number|string} localeID - The ID or the BCP-47 code of the locale (e.g., 'en-US', 'es-419'). * @returns {Promise} Details of the specified locale. - * @async * @throws {Error} Throws an error if the API request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#show-locale} * @example @@ -44,7 +41,6 @@ class Locales extends Client { /** * Retrieves the locale information of the currently logged-in user. * @returns {Promise} Details of the current user's locale. - * @async * @throws {Error} Throws an error if the API request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#show-current-locale} * @example @@ -58,7 +54,6 @@ class Locales extends Client { /** * Alias for showCurrent. Retrieves the locale information of the currently logged-in user. * @returns {Promise} Details of the current user's locale. - * @async * @throws {Error} Throws an error if the API request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#show-current-locale} * @example @@ -72,7 +67,6 @@ class Locales extends Client { /** * Lists the translation locales that have been localized for agents on a specific account. * @returns {Promise} List of locales available for agents. - * @async * @throws {Error} Throws an error if the API request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#list-locales-for-agent} * @example @@ -86,7 +80,6 @@ class Locales extends Client { /** * Lists the translation locales that are available to all accounts. * @returns {Promise} List of public locales available to all accounts. - * @async * @throws {Error} Throws an error if the API request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#list-available-public-locales} * @example @@ -101,7 +94,6 @@ class Locales extends Client { * Detects the best language/locale for the user based on provided available locales. * @param {string[]} availableLocales - Array of available locales e.g., ['es', 'ja', 'en-uk']. * @returns {Promise} Best detected locale for the user. - * @async * @throws {Error} Throws an error if the API request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#detect-best-language-for-user} * @example diff --git a/src/clients/core/macros.js b/src/clients/core/macros.js index 4b2476bc..fdb1f6e2 100644 --- a/src/clients/core/macros.js +++ b/src/clients/core/macros.js @@ -14,7 +14,6 @@ class Macros extends Client { /** * Lists all shared and personal macros available to the current user. * @returns {Promise} Returns a promise that resolves to an array of macros. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#list-macros} Zendesk List Macros API * @example @@ -28,7 +27,6 @@ class Macros extends Client { * Retrieves details of a specific macro. * @param {number} macroID - The ID of the macro to retrieve. * @returns {Promise} Returns a promise that resolves to the macro's details. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#show-macro} Zendesk Show Macro API * @example @@ -42,7 +40,6 @@ class Macros extends Client { * Searches for macros based on provided query. * @param {string} query - The search query string. * @returns {Promise>} - A promise that resolves to a list of matched macros. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#search-macros} * @example @@ -55,7 +52,6 @@ class Macros extends Client { /** * Lists all active macros. * @returns {Promise>} - A promise that resolves to a list of active macros. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#list-active-macros} * @example @@ -69,7 +65,6 @@ class Macros extends Client { * Lists macros based on provided parameters. * @param {object} parameters - The filtering parameters. * @returns {Promise} - A promise that resolves to a list of macros. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#list-macros} * @example @@ -83,7 +78,6 @@ class Macros extends Client { * Applies a macro to a ticket. * @param {number} macroID - The ID of the macro. * @returns {Promise} - A promise that resolves to the applied macro's result. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#show-macro-replica} * @example @@ -98,7 +92,6 @@ class Macros extends Client { * @param {number} ticketID - The ID of the ticket from which to build a macro replica. * @param {number} macroID - The ID of the macro. * @returns {Promise} - A promise that resolves to the macro replica. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#show-macro-replica} * @example @@ -116,7 +109,6 @@ class Macros extends Client { * @param {boolean} [macro.active] - Whether the macro is active. * @param {string} [macro.description] - The description of the macro. * @returns {Promise} - A promise that resolves to the created macro. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#create-macro} * @example @@ -132,7 +124,6 @@ class Macros extends Client { /** * Lists all macro categories available to the current user. * @returns {Promise} - A promise that resolves to a list of macro categories. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#list-macro-categories} * @example @@ -147,7 +138,6 @@ class Macros extends Client { * @param {number} macroID - The ID of the macro to update. * @param {object} macro - The updates to apply to the macro. * @returns {Promise} - A promise that resolves to the updated macro. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#update-macro} * @example @@ -163,7 +153,6 @@ class Macros extends Client { * Deletes a specified macro. * @param {number} macroID - The ID of the macro to delete. * @returns {Promise} - A promise indicating successful deletion. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#delete-macro} * @example @@ -177,7 +166,6 @@ class Macros extends Client { * Updates multiple macros. * @param {Array} macrosUpdates - An array of macro update objects. * @returns {Promise>} - A promise that resolves to an array of updated macros. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#update-many-macros} * @example diff --git a/src/clients/core/oauthclients.js b/src/clients/core/oauthclients.js index f4b335b2..5f0c9413 100644 --- a/src/clients/core/oauthclients.js +++ b/src/clients/core/oauthclients.js @@ -14,7 +14,6 @@ class OAuthClients extends Client { /** * Lists all OAuth clients. * @returns {Promise} A list of OAuth clients. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#list-clients} * @example const clientsList = await client.oauthclients.list(); @@ -27,7 +26,6 @@ class OAuthClients extends Client { * Retrieves a specific OAuth client by ID. * @param {number} id - The ID of the OAuth client. * @returns {Promise} The OAuth client details. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#show-client} * @example const clientDetails = await client.oauthclients.show(1234); @@ -40,7 +38,6 @@ class OAuthClients extends Client { * Creates a new OAuth client with the provided details. * @param {object} client - The details of the client to be created. * @returns {Promise} The details of the created OAuth client. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#create-client} * @example @@ -59,7 +56,6 @@ class OAuthClients extends Client { * @param {number} id - The ID of the OAuth client. * @param {object} client - The new details of the client. * @returns {Promise} The updated OAuth client details. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#update-client} * @example @@ -76,7 +72,6 @@ class OAuthClients extends Client { * Deletes a specific OAuth client by ID. * @param {number} id - The ID of the OAuth client. * @returns {Promise} - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#delete-client} * @example await client.oauthclients.delete(1234); @@ -89,7 +84,6 @@ class OAuthClients extends Client { * Generates a new client secret for a specific OAuth client by ID. * @param {number} id - The ID of the OAuth client. * @returns {Promise} The new client secret. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#generate-secret} * @example const newSecret = await client.oauthclients.generateSecret(1234); diff --git a/src/clients/core/oauthtokens.js b/src/clients/core/oauthtokens.js index 214eb5ce..415dda41 100644 --- a/src/clients/core/oauthtokens.js +++ b/src/clients/core/oauthtokens.js @@ -15,7 +15,6 @@ class OAuthTokens extends Client { * Retrieves a specific OAuth token by ID. * @param {number|string} id - The ID of the OAuth token or "current" for the currently authenticated token. * @returns {Promise} The OAuth token details. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#show-token} * @example const tokenDetails = await client.oauthtokens.show(1234); @@ -27,7 +26,6 @@ class OAuthTokens extends Client { /** * Retrieves the details of the currently authenticated OAuth token. * @returns {Promise} The details of the currently authenticated OAuth token. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#show-token} * @example const currentTokenDetails = await client.oauthtokens.current(); @@ -39,7 +37,6 @@ class OAuthTokens extends Client { /** * Lists all available OAuth tokens. * @returns {Promise} A list of OAuth tokens. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#list-tokens} * @example const tokensList = await client.oauthtokens.list(); @@ -52,7 +49,6 @@ class OAuthTokens extends Client { * Revokes a specific OAuth token by ID. * @param {number} id - The ID of the OAuth token. * @returns {Promise} - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#revoke-token} * @example await client.oauthtokens.revoke(1234); @@ -65,7 +61,6 @@ class OAuthTokens extends Client { * Creates a new OAuth token with the provided details. * @param {object} token - The details of the token to be created. Must include client_id and scopes. * @returns {Promise} The details of the created OAuth token. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#create-token} * @example const createdToken = await client.oauthtokens.create({client_id: 1234, scopes: ["read", "write"]}); diff --git a/src/clients/core/organizationfields.js b/src/clients/core/organizationfields.js index 90895bc4..c2c9d076 100644 --- a/src/clients/core/organizationfields.js +++ b/src/clients/core/organizationfields.js @@ -14,7 +14,6 @@ class OrganizationFields extends Client { /** * List all organization fields. * @returns {Promise} The organization fields. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_fields/#list-organization-fields} * @example const orgFields = await client.organizationfields.list(); */ @@ -26,7 +25,6 @@ class OrganizationFields extends Client { * Show a specific organization field. * @param {number} organizationFieldID - The ID of the organization field. * @returns {Promise} The organization field details. - * @async * @throws {Error} Throws an error if the organization field is not found. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_fields/#show-organization-field} * @example const orgField = await client.organizationfields.show(12345); @@ -39,7 +37,6 @@ class OrganizationFields extends Client { * Create a new organization field. * @param {object} organizationField - The organization field object. * @returns {Promise} The newly created organization field. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_fields/#create-organization-field} * @example const newOrgField = await client.organizationfields.create({ type: 'text', title: 'Support description' }); */ @@ -52,7 +49,6 @@ class OrganizationFields extends Client { * @param {number} organizationFieldID - The ID of the organization field to update. * @param {object} organizationField - The updated organization field object. * @returns {Promise} The updated organization field. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_fields/#update-organization-field} * @example const updatedOrgField = await client.organizationfields.update(12345, { title: 'New title' }); */ @@ -67,7 +63,6 @@ class OrganizationFields extends Client { * Delete an organization field. * @param {number} organizationFieldID - The ID of the organization field to delete. * @returns {Promise} Response indicating the deletion status. - * @async * @throws {Error} Throws an error if the deletion fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_fields/#delete-organization-field} * @example await client.organizationfields.delete(12345); @@ -80,7 +75,6 @@ class OrganizationFields extends Client { * Reorder the organization fields. * @param {Array} organizationFieldIds - An array of organization field IDs in the desired order. * @returns {Promise} The reordered organization fields. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_fields/#reorder-organization-field} * @example await client.organizationfields.reorder([3, 4]); */ diff --git a/src/clients/core/organizationmemberships.js b/src/clients/core/organizationmemberships.js index d5422dd8..66162c62 100644 --- a/src/clients/core/organizationmemberships.js +++ b/src/clients/core/organizationmemberships.js @@ -14,7 +14,6 @@ class OrganizationMemberships extends Client { /** * List all organization memberships. * @returns {Promise} A promise resolving to an array of organization memberships. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#list-memberships} * @example * const memberships = await client.organizationmemberships.list(); @@ -27,7 +26,6 @@ class OrganizationMemberships extends Client { * List organization memberships by a specific user ID. * @param {number} userID - The user ID. * @returns {Promise} A promise resolving to an array of organization memberships for the user. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#list-memberships} * @example * const memberships = await client.organizationmemberships.listByUser(123); @@ -40,7 +38,6 @@ class OrganizationMemberships extends Client { * List organization memberships by a specific organization ID. * @param {number} organiationID - The organization ID. * @returns {Promise} A promise resolving to an array of organization memberships for the organization. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#list-memberships} * @example * const memberships = await client.organizationmemberships.listByOrganization(456); @@ -57,7 +54,6 @@ class OrganizationMemberships extends Client { * Retrieve a specific organization membership by its ID. * @param {number} organizationMembershipID - The organization membership ID. * @returns {Promise} A promise resolving to the organization membership. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#show-membership} * @example * const membership = await client.organizationmemberships.show(789); @@ -71,7 +67,6 @@ class OrganizationMemberships extends Client { * @param {number} userID - The user ID. * @param {number} organizationMembershipID - The organization membership ID. * @returns {Promise} A promise resolving to the organization membership. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#show-membership} * @example * const membership = await client.organizationmemberships.showByUser(123, 789); @@ -89,7 +84,6 @@ class OrganizationMemberships extends Client { * Create a new organization membership. * @param {OrganizationMembership} organizationMembership - The organization membership data. * @returns {Promise} A promise resolving to the created organization membership. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#create-membership} * @example * const newMembership = await client.organizationmemberships.create({ user_id: 123, organization_id: 456 }); @@ -106,7 +100,6 @@ class OrganizationMemberships extends Client { * @param {object} organizationMembership - The organization membership data. * @param {number} organizationMembership.organization_id - The organization id of the membership. * @returns {Promise} A promise resolving to the created organization membership. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#create-membership} * @example * const newMembership = await client.organizationmemberships.createByUser(123, { organization_id: 456 }); @@ -129,7 +122,6 @@ class OrganizationMemberships extends Client { * Create multiple organization memberships at once. * @param {OrganizationMembership[]} organizationMemberships - An array of organization membership data. * @returns {Promise} A promise resolving to a job status. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#create-many-memberships} * @example * const jobStatus = await client.organizationmemberships.createMany([{ user_id: 123, organization_id: 456 }, ...]); @@ -144,7 +136,6 @@ class OrganizationMemberships extends Client { * Delete a specific organization membership by its ID. * @param {number} organizationMembershipID - The organization membership ID. * @returns {Promise} A promise indicating the completion of the delete operation. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#delete-membership} * @example * await client.organizationmemberships.delete(789); @@ -158,7 +149,6 @@ class OrganizationMemberships extends Client { * @param {number} userID - The user ID. * @param {number} organizationMembershipID - The organization membership ID. * @returns {Promise} A promise indicating the completion of the delete operation. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#delete-membership} * @example * await client.organizationmemberships.deleteByUser(123, 789); @@ -176,7 +166,6 @@ class OrganizationMemberships extends Client { * Delete multiple organization memberships by their IDs. * @param {number[]} organizationMembershipIDs - An array of organization membership IDs. * @returns {Promise} A promise resolving to a job status. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#bulk-delete-memberships} * @example * const jobStatus = await client.organizationmemberships.deleteMany([789, 790, 791]); @@ -194,7 +183,6 @@ class OrganizationMemberships extends Client { * @param {number} userID - The user ID. * @param {number} organizationMembershipID - The organization membership ID. * @returns {Promise} A promise resolving to the updated organization membership. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#set-membership-as-default} * @example * const updatedMembership = await client.organizationmemberships.setDefault(123, 789); diff --git a/src/clients/core/organizations.js b/src/clients/core/organizations.js index fdd304ea..d093ed30 100644 --- a/src/clients/core/organizations.js +++ b/src/clients/core/organizations.js @@ -3,7 +3,7 @@ const {Client} = require('../client'); /** * @class - * @description Client for interacting with the Zendesk Organizations API. + * Client for interacting with the Zendesk Organizations API. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/} */ class Organizations extends Client { @@ -13,9 +13,8 @@ class Organizations extends Client { } /** - * @description Lists all organizations. + * Lists all organizations. * @returns {Promise} The list of organizations. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#list-organizations} * @example const organizations = await client.organizations.list(); */ @@ -24,10 +23,9 @@ class Organizations extends Client { } /** - * @description Lists organizations associated with a specific user. + * Lists organizations associated with a specific user. * @param {number} userID - The ID of the user. * @returns {Promise} List of organizations associated with the user. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#list-organizations} * @example const userOrgs = await client.organizations.listByUser(12345); */ @@ -36,9 +34,8 @@ class Organizations extends Client { } /** - * @description Counts the number of organizations. + * Counts the number of organizations. * @returns {Promise} Number of organizations. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#count-organizations} * @example const orgCount = await client.organizations.count(); */ @@ -48,10 +45,9 @@ class Organizations extends Client { } /** - * @description Counts the number of organizations associated with a specific user. + * Counts the number of organizations associated with a specific user. * @param {number} userID - The ID of the user. * @returns {Promise} Number of organizations associated with the user. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#count-organizations} * @example const userOrgCount = await client.organizations.countByUser(12345); */ @@ -66,10 +62,9 @@ class Organizations extends Client { } /** - * @description Retrieves related information for a specific organization. + * Retrieves related information for a specific organization. * @param {number} organizationID - The ID of the organization. * @returns {Promise} Object containing related information of the organization. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organizations-related-information} * @example const relatedInfo = await client.organizations.related(12345); */ @@ -78,10 +73,9 @@ class Organizations extends Client { } /** - * @description Views a specific organization by its ID. + * Views a specific organization by its ID. * @param {number} organizationID - The ID of the organization. * @returns {Promise} The organization's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organization} * @example const organization = await client.organizations.show(12345); */ @@ -90,10 +84,9 @@ class Organizations extends Client { } /** - * @description Retrieves details of multiple organizations based on their IDs. + * Retrieves details of multiple organizations based on their IDs. * @param {number[]} organizationIDs - Array of organization IDs. * @returns {Promise} List of organizations' details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-many-organizations} * @example const orgDetails = await client.organizations.showMany([12345, 67890]); */ @@ -108,10 +101,9 @@ class Organizations extends Client { } /** - * @description Retrieves details of multiple organizations based on their External IDs. + * Retrieves details of multiple organizations based on their External IDs. * @param {string[]} externalOrganizationIds - Array of organization IDs. * @returns {Promise} List of organizations' details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-many-organizations} * @example const orgDetails = await client.organizations.showMany(['12345', '67890']); */ @@ -126,10 +118,9 @@ class Organizations extends Client { } /** - * @description Creates a new organization. + * Creates a new organization. * @param {object} organization - The organization object to create. * @returns {Promise} The created organization's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-organization} * @example const newOrganization = await client.organizations.create({ name: 'New Org' }); */ @@ -138,10 +129,9 @@ class Organizations extends Client { } /** - * @description Creates multiple organizations. + * Creates multiple organizations. * @param {object[]} organizations - An array of organization objects to create. * @returns {Promise} Details of the created organizations. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-many-organizations} * @example const newOrganizations = await client.organizations.createMany([{ name: 'Org1' }, { name: 'Org2' }]); */ @@ -150,10 +140,9 @@ class Organizations extends Client { } /** - * @description Creates or updates an organization. + * Creates or updates an organization. * @param {object} organization - The organization object to create or update. * @returns {Promise} The created or updated organization's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-or-update-organization} * @example const org = await client.organizations.createOrUpdate({ id: 12345, name: 'Updated Name' }); */ @@ -162,11 +151,10 @@ class Organizations extends Client { } /** - * @description Updates a specific organization by its ID. + * Updates a specific organization by its ID. * @param {number} organizationID - The ID of the organization. * @param {object} organization - The updated organization object. * @returns {Promise} The updated organization's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#update-organization} * @example const updatedOrganization = await client.organizations.update(12345, { name: 'New Name' }); */ @@ -175,10 +163,9 @@ class Organizations extends Client { } /** - * @description Updates multiple organizations. + * Updates multiple organizations. * @param {object[]} organizations - An array of organization objects to update. * @returns {Promise} Details of the updated organizations. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#update-many-organizations} * @example const updatedOrganizations = await client.organizations.updateMany([{ id: 1, name: 'Updated Org1' }, { id: 2, name: 'Updated Org2' }]); */ @@ -187,10 +174,9 @@ class Organizations extends Client { } /** - * @description Creates or updates an organization, similar to `createOrUpdate` method. + * Creates or updates an organization, similar to `createOrUpdate` method. * @param {object} organization - The organization object to upsert. * @returns {Promise} The created or updated organization's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-or-update-organization} * @example const org = await client.organizations.upsert({ id: 12345, name: 'Upserted Name' }); */ @@ -199,10 +185,9 @@ class Organizations extends Client { } /** - * @description Deletes a specific organization by its ID. + * Deletes a specific organization by its ID. * @param {number} organizationID - The ID of the organization to delete. * @returns {Promise} - * @async * @throws {Error} Throws an error if deletion fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#delete-organization} * @example await client.organizations.delete(12345); @@ -212,10 +197,9 @@ class Organizations extends Client { } /** - * @description Deletes multiple organizations based on their IDs. + * Deletes multiple organizations based on their IDs. * @param {number[]} organizationIds - Array of organization IDs. * @returns {Promise} Returns a job status JSON object. - * @async * @throws {Error} Throws an error if deletion fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#bulk-delete-organizations} * @example await client.organizations.bulkDelete([12345, 67890]); @@ -231,10 +215,9 @@ class Organizations extends Client { } /** - * @description Deletes multiple organizations based on their external IDs. + * Deletes multiple organizations based on their external IDs. * @param {string[]} organizationExternalIds - Array of organization external IDs. * @returns {Promise} Returns a job status JSON object. - * @async * @throws {Error} Throws an error if deletion fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#bulk-delete-organizations} * @example await client.organizations.bulkDeleteByExternalId(['ext-12345', 'ext-67890']); @@ -250,10 +233,9 @@ class Organizations extends Client { } /** - * @description Searches organizations based on external ID. + * Searches organizations based on external ID. * @param {number} externalID - Search by externalID. * @returns {Promise} List of organizations matching the search. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#search-organizations-by-external-id} * @example const foundOrganizations = await client.organizations.search(1234); */ @@ -262,10 +244,9 @@ class Organizations extends Client { } /** - * @description Autocompletes organization names based on provided parameters. + * Autocompletes organization names based on provided parameters. * @param {object} parameters - Parameters for autocomplete. * @returns {Promise} List of organizations matching the autocomplete. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#autocomplete-organizations} * @example const autocompleteResults = await client.organizations.autocomplete({ name: 'Test' }); */ @@ -274,11 +255,10 @@ class Organizations extends Client { } /** - * @description Incrementally exports organizations with an include parameter. + * Incrementally exports organizations with an include parameter. * @param {string|Date} startTime - Start time for incremental export. * @param {string} include - Data to include in the export. * @returns {Promise} List of organizations in the incremental export. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-organization-export} * @example const exportedOrganizations = await client.organizations.incrementalInclude('2023-01-01T12:00:00Z', 'users'); */ @@ -291,10 +271,9 @@ class Organizations extends Client { } /** - * @description Incrementally exports organizations. + * Incrementally exports organizations. * @param {string|Date} startTime - Start time for incremental export. * @returns {Promise} List of organizations in the incremental export. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-organization-export} * @example const exportedOrganizations = await client.organizations.incremental('2023-01-01T12:00:00Z'); */ @@ -307,10 +286,9 @@ class Organizations extends Client { } /** - * @description Fetches a sample of incremental organization exports. + * Fetches a sample of incremental organization exports. * @param {string|Date} startTime - Start time for the sample. * @returns {Promise} Sample list of organizations in the incremental export. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-sample-export} * @example const sampleExportedOrganizations = await client.organizations.incrementalSample('2023-01-01T12:00:00Z'); */ diff --git a/src/clients/core/permissiongroups.js b/src/clients/core/permissiongroups.js index a569cfb8..5d8bc22a 100644 --- a/src/clients/core/permissiongroups.js +++ b/src/clients/core/permissiongroups.js @@ -14,7 +14,6 @@ class PermissionGroups extends Client { /** * List all permission groups. * @returns {Promise} Array of permission group objects. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/help_center/help-center-api/permission_groups/#list-permission-groups} * @example @@ -28,7 +27,6 @@ class PermissionGroups extends Client { * Retrieve details of a specific permission group. * @param {number} groupID - The ID of the permission group. * @returns {Promise} Permission group object. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/help_center/help-center-api/permission_groups/#show-permission-group} * @example @@ -45,7 +43,6 @@ class PermissionGroups extends Client { * @param {number[]} [group.edit] - Array of user segments that have edit privileges. * @param {number[]} [group.publish] - Array of user segments that have publish privileges. * @returns {Promise} Newly created permission group object. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/help_center/help-center-api/permission_groups/#create-permission-group} * @example @@ -67,7 +64,6 @@ class PermissionGroups extends Client { * @param {number[]} [group.edit] - Array of user segments that have edit privileges. * @param {number[]} [group.publish] - Array of user segments that have publish privileges. * @returns {Promise} Updated permission group object. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/help_center/help-center-api/permission_groups/#update-permission-group} * @example @@ -83,7 +79,6 @@ class PermissionGroups extends Client { * Delete a permission group. * @param {number} groupID - The ID of the permission group. * @returns {Promise} - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/help_center/help-center-api/permission_groups/#delete-permission-group} * @example diff --git a/src/clients/core/policies.js b/src/clients/core/policies.js index 013ded25..feed1174 100644 --- a/src/clients/core/policies.js +++ b/src/clients/core/policies.js @@ -18,7 +18,6 @@ class Policies extends Client { /** * List all the SLA Policies. * @returns {Promise} - A promise that resolves to the list of policies. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#list-sla-policies} * @example const policiesList = await client.policies.list(); */ @@ -30,7 +29,6 @@ class Policies extends Client { * Show details of a specific SLA Policy. * @param {number} policyID - The ID of the SLA Policy. * @returns {Promise} - A promise that resolves to the policy details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#show-sla-policy} * @example const policyDetails = await client.policies.show(25); */ @@ -42,7 +40,6 @@ class Policies extends Client { * Create a new SLA Policy. * @param {object} policy - The SLA Policy object to be created. * @returns {Promise} - A promise that resolves to the newly created policy details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#create-sla-policy} * @example * const newPolicy = { @@ -61,7 +58,6 @@ class Policies extends Client { * @param {number} policyID - The ID of the SLA Policy to be updated. * @param {object} policy - The updated SLA Policy object. * @returns {Promise} - A promise that resolves to the updated policy details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#update-sla-policy} * @example * const updatedPolicy = { @@ -78,7 +74,6 @@ class Policies extends Client { * Delete a specific SLA Policy. * @param {number} policyID - The ID of the SLA Policy to be deleted. * @returns {Promise} - A promise that resolves when the policy has been deleted. - * @async * @throws Will throw an error if the deletion is unsuccessful. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#delete-sla-policy} * @example await client.policies.delete(25); @@ -91,7 +86,6 @@ class Policies extends Client { * Reorder SLA Policies based on provided IDs. * @param {number[]} slaPolicyIds - Array of SLA policy IDs in the desired order. * @returns {Promise} The response from the Zendesk API. - * @async * @throws {Error} Throws an error if there's an issue with the request. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#reorder-sla-policies} * @example @@ -104,7 +98,6 @@ class Policies extends Client { /** * Retrieve a list of supported filter definition items. * @returns {Promise} The response from the Zendesk API containing supported filter definitions. - * @async * @throws {Error} Throws an error if there's an issue with the request. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#retrieve-supported-filter-definition-items} * @example diff --git a/src/clients/core/requests.js b/src/clients/core/requests.js index f725ddaa..104cc079 100644 --- a/src/clients/core/requests.js +++ b/src/clients/core/requests.js @@ -27,7 +27,6 @@ class Requests extends Client { * @param {string} [parameters.sort_by] - Sort by "updated_at" or "created_at". * @param {string} [parameters.sort_order] - Sort order: "asc" or "desc". * @returns {Promise} List of ticket requests. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#list-requests} * @example const requests = await client.requests.list({ sort_by: 'updated_at', sort_order: 'desc' }); @@ -42,7 +41,6 @@ class Requests extends Client { * @param {string} [parameters.sort_by] - Sort by "updated_at" or "created_at". * @param {string} [parameters.sort_order] - Sort order: "asc" or "desc". * @returns {Promise} List of open ticket requests. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#list-requests} * @example const openRequests = await client.requests.listOpen(); @@ -57,7 +55,6 @@ class Requests extends Client { * @param {string} [parameters.sort_by] - Sort by "updated_at" or "created_at". * @param {string} [parameters.sort_order] - Sort order: "asc" or "desc". * @returns {Promise} List of solved ticket requests. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#list-requests} * @example const solvedRequests = await client.requests.listSolved(); @@ -72,7 +69,6 @@ class Requests extends Client { * @param {string} [parameters.sort_by] - Sort by "updated_at" or "created_at". * @param {string} [parameters.sort_order] - Sort order: "asc" or "desc". * @returns {Promise} List of CCD ticket requests. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#list-requests} * @example const ccdRequests = await client.requests.listCCD(); @@ -88,7 +84,6 @@ class Requests extends Client { * @param {string} [parameters.sort_by] - Sort by "updated_at" or "created_at". * @param {string} [parameters.sort_order] - Sort order: "asc" or "desc". * @returns {Promise} List of ticket requests for the specified user. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#list-requests} * @example const userRequests = await client.requests.listByUser(12345); @@ -104,7 +99,6 @@ class Requests extends Client { * @param {string} [parameters.sort_by] - Sort by "updated_at" or "created_at". * @param {string} [parameters.sort_order] - Sort order: "asc" or "desc". * @returns {Promise} List of ticket requests for the specified organization. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#list-requests} * @example const orgRequests = await client.requests.listByOrganization(6789); @@ -118,7 +112,6 @@ class Requests extends Client { * @param {object} parameters - Search parameters. * @param {string} parameters.query - The query string. * @returns {Promise} List of matching ticket requests. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#search-requests} * @example const searchResults = await client.requests.search({ query: 'printer' }); @@ -131,7 +124,6 @@ class Requests extends Client { * Retrieve a specific ticket request. * @param {number} requestId - The ID of the ticket request. * @returns {Promise} The ticket request details. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#show-request} * @example const requestDetails = await client.requests.show(1234); @@ -144,7 +136,6 @@ class Requests extends Client { * Retrieve a specific ticket request. * @param {number} requestId - The ID of the ticket request. * @returns {Promise} The ticket request details. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#show-request} * @example const requestDetails = await client.requests.show(1234); @@ -158,7 +149,6 @@ class Requests extends Client { * Create a new ticket request. * @param {object} requestDetails - Details of the ticket request to be created. * @returns {Promise} The created ticket request details. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#create-request} * @example @@ -179,7 +169,6 @@ class Requests extends Client { * @param {number} requestId - The ID of the ticket request. * @param {object} updateDetails - Details to update. * @returns {Promise} The updated ticket request details. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#update-request} * @example @@ -198,7 +187,6 @@ class Requests extends Client { * List all comments for a specific ticket request. * @param {number} requestId - The ID of the ticket request. * @returns {Promise} List of comments for the ticket request. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#listing-comments} * @example const comments = await client.requests.listComments(1234); @@ -212,7 +200,6 @@ class Requests extends Client { * @param {number} requestId - The ID of the ticket request. * @param {number} commentId - The ID of the comment to retrieve. * @returns {Promise} The comment details for the specified ticket request. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#listing-comments} * @example const comment = await client.requests.getComment(1234, 5678); diff --git a/src/clients/core/satisfactionratings.js b/src/clients/core/satisfactionratings.js index 3dbd34a3..b916f1fe 100644 --- a/src/clients/core/satisfactionratings.js +++ b/src/clients/core/satisfactionratings.js @@ -17,7 +17,6 @@ class SatisfactionRatings extends Client { /** * Lists all satisfaction ratings. * @returns {Array} A list of satisfaction ratings. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/satisfaction_ratings/#list-satisfaction-ratings} * @example const ratings = await client.satisfactionratings.list(); */ @@ -28,7 +27,6 @@ class SatisfactionRatings extends Client { /** * Lists all received satisfaction ratings. * @returns {Array} A list of received satisfaction ratings. - * @async * @example const ratingsReceived = await client.satisfactionratings.received(); */ async received() { @@ -39,7 +37,6 @@ class SatisfactionRatings extends Client { * Retrieves details of a specific satisfaction rating. * @param {number} satisfactionRatingID - The ID of the satisfaction rating to retrieve. * @returns {object} Details of the satisfaction rating. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/satisfaction_ratings/#show-satisfaction-rating} * @example const ratingDetails = await client.satisfactionratings.show(12345); */ @@ -52,7 +49,6 @@ class SatisfactionRatings extends Client { * @param {number} ticketID - The ID of the ticket. * @param {object} satisfactionRating - The details of the satisfaction rating to create. * @returns {object} The created satisfaction rating. - * @async * @throws Will throw an error if the requester is not an end user of the ticket or if the ticket is not solved. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/satisfaction_ratings/#create-a-satisfaction-rating} * @example @@ -72,7 +68,6 @@ class SatisfactionRatings extends Client { * Incrementally exports satisfaction ratings based on a start time. * @param {number} startTime - The start time for the incremental export (Unix epoch time). * @returns {Array} A list of satisfaction ratings from the specified start time. - * @async * @see {@link https://developer.zendesk.com/api-reference/live-chat/chat-api/incremental_export/#start-time} * @example const ratingsExported = await client.satisfactionratings.incremental(1498151194); */ diff --git a/src/clients/core/search.js b/src/clients/core/search.js index 533e66cb..30a1ccd3 100644 --- a/src/clients/core/search.js +++ b/src/clients/core/search.js @@ -15,7 +15,6 @@ class Search extends Client { * Search for the given term and retrieve results. * @param {string} searchTerm - The term to search for. * @returns {Promise} A JSON object with the search results. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#list-search-results} * @example * const results = await client.search.query('open tickets'); @@ -28,7 +27,6 @@ class Search extends Client { * Search for the given term and retrieve all results. * @param {string} searchTerm - The term to search for. * @returns {Promise} An array of search results. - * @async * @example * const allResults = await client.search.queryAll('open tickets'); */ @@ -40,7 +38,6 @@ class Search extends Client { * Anonymous search for the given term and retrieve results. * @param {string} searchTerm - The term to search for. * @returns {Promise} A JSON object with the search results. - * @async * @example * const anonResults = await client.search.queryAnonymous('open tickets'); */ @@ -52,7 +49,6 @@ class Search extends Client { * Anonymous search for the given term and retrieve all results. * @param {string} searchTerm - The term to search for. * @returns {Promise} An array of search results. - * @async * @example * const allAnonResults = await client.search.queryAnonymousAll('open tickets'); */ @@ -64,7 +60,6 @@ class Search extends Client { * Retrieve the count of search results for the given term. * @param {string} searchTerm - The term to search for. * @returns {Promise} An Object with the number of items matching the query. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#show-results-count} * @example * const { count } = await client.search.showResultsCount('open tickets'); @@ -79,7 +74,6 @@ class Search extends Client { * @param {string} objectType - The type of object to return (ticket, organization, user, or group). * @param {number} [pageSize=100] - The number of results per page. * @returns {Promise} An array of search results. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#export-search-results} * @example * const { results } = await client.search.exportResults('open tickets', 'ticket'); diff --git a/src/clients/core/sessions.js b/src/clients/core/sessions.js index 8cc89512..8e0766cf 100644 --- a/src/clients/core/sessions.js +++ b/src/clients/core/sessions.js @@ -14,7 +14,6 @@ class Sessions extends Client { /** * List all sessions. * @returns {Promise} Array of sessions. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#list-sessions} * @example * const sessions = await client.sessions.get(); @@ -27,7 +26,6 @@ class Sessions extends Client { * List sessions by user ID. * @param {number} userId - The ID of the user. * @returns {Promise} Array of sessions. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#list-sessions} * @example * const sessions = await client.sessions.getByUserId(12345); @@ -41,7 +39,6 @@ class Sessions extends Client { * @param {number} userId - The ID of the user. * @param {number} sessionId - The ID of the session. * @returns {Promise} Session details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#show-session} * @example * const session = await client.sessions.getByUserIdBySessionId(12345, 67890); @@ -53,7 +50,6 @@ class Sessions extends Client { /** * Retrieve details of the currently authenticated session. * @returns {Promise} Session details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#show-the-currently-authenticated-session} * @example * const session = await client.sessions.getMyAuthenticatedSession(); @@ -67,7 +63,6 @@ class Sessions extends Client { * @param {number} userId - The ID of the user. * @param {number} sessionId - The ID of the session. * @returns {Promise} - * @async * @throws Will throw an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#delete-session} * @example @@ -81,7 +76,6 @@ class Sessions extends Client { * Delete all sessions for a specific user by user ID. * @param {number} userId - The ID of the user. * @returns {Promise} - * @async * @throws Will throw an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#bulk-delete-sessions} * @example @@ -94,7 +88,6 @@ class Sessions extends Client { /** * Logs out the current authenticated user. * @returns {Promise} - * @async * @throws Will throw an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#delete-the-authenticated-session} * @example diff --git a/src/clients/core/sharingagreement.js b/src/clients/core/sharingagreement.js index 7963710c..02b48d7b 100644 --- a/src/clients/core/sharingagreement.js +++ b/src/clients/core/sharingagreement.js @@ -15,7 +15,6 @@ class SharingAgreement extends Client { /** * List all Sharing Agreements. * @returns {Promise} An array of Sharing Agreement objects. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/sharing_agreements/#list-sharing-agreements} * @example @@ -29,7 +28,6 @@ class SharingAgreement extends Client { * Show a specific Sharing Agreement by its ID. * @param {number} id The ID of the Sharing Agreement. * @returns {Promise} The Sharing Agreement object. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/sharing_agreements/#show-a-sharing-agreement} * @example @@ -43,7 +41,6 @@ class SharingAgreement extends Client { * Create a new Sharing Agreement. * @param {object} data The data for the new Sharing Agreement. * @returns {Promise} The created Sharing Agreement object. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/sharing_agreements/#create-sharing-agreement} * @example @@ -61,7 +58,6 @@ class SharingAgreement extends Client { * @param {number} id The ID of the Sharing Agreement to update. * @param {object} data The data to update the Sharing Agreement with. Only 'status' is allowed. * @returns {Promise} The updated Sharing Agreement object. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/sharing_agreements/#update-a-sharing-agreement} * @example @@ -78,7 +74,6 @@ class SharingAgreement extends Client { * Delete a specific Sharing Agreement by its ID. * @param {number} id The ID of the Sharing Agreement. * @returns {Promise} - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/sharing_agreements/#delete-a-sharing-agreement} * @example diff --git a/src/clients/core/sideconversations.js b/src/clients/core/sideconversations.js index 05e800e3..abf13173 100644 --- a/src/clients/core/sideconversations.js +++ b/src/clients/core/sideconversations.js @@ -71,7 +71,6 @@ const {ApiTypes} = require('../../constants'); class SideConversations extends Client { /** - * @constructs SideConversations * @param {import('../client').ClientOptions} options - The client options. */ constructor(options) { @@ -84,7 +83,6 @@ class SideConversations extends Client { * @param {number} ticketId - The ID of the ticket. * @param {CreateSideConversation} message - The side conversation object. * @returns {Promise<{result: SideConversationResponse}>} The created ticket details. - * @async * @throws {Error} If the details are not provided or invalid. * @see https://developer.zendesk.com/api-reference/ticketing/side_conversation/side_conversation/#create-side-conversation */ @@ -98,7 +96,6 @@ class SideConversations extends Client { * @param {string} sideConversationId - The ID of the side conversation. * @param {{message: Message}} message - The reply object. * @returns {Promise<{result: SideConversationResponse}>} The created ticket details. - * @async * @throws {Error} If the details are not provided or invalid. * @see https://developer.zendesk.com/api-reference/ticketing/side_conversation/side_conversation/#reply-to-side-conversation */ @@ -115,7 +112,6 @@ class SideConversations extends Client { * @param {string} sideConversationId - The ID of the side conversation. * @param {{side_conversation: Partial}} update - The update object. * @returns {Promise<{result: SideConversationResponse}>} The updated ticket details. - * @async * @throws {Error} If the details are not provided or invalid. * @see https://developer.zendesk.com/api-reference/ticketing/side_conversation/side_conversation/#update-side-conversation */ @@ -130,7 +126,6 @@ class SideConversations extends Client { * List all the Side Conversations tickets. * @param {number} ticketID - the Id of the ticket. * @returns {Promise<{result: Array<{ side_conversations: SideConversation[] }>}>} An array of tickets. - * @async * @see https://developer.zendesk.com/api-reference/ticketing/side_conversation/side_conversation/#list-side-conversations * @example * const tickets = await client.sideconversations.list(123); @@ -144,7 +139,6 @@ class SideConversations extends Client { * @param {number} ticketId - The ID of the ticket. * @param {string} sideConversationId - The ID of the side conversation. * @returns {Promise<{result: SideConversation}>} Details of the side conversation. - * @async * @throws {Error} If the ticket ID is not provided or invalid. * @see https://developer.zendesk.com/api-reference/ticketing/side_conversation/side_conversation/#show-side-conversation * @example diff --git a/src/clients/core/suspendedtickets.js b/src/clients/core/suspendedtickets.js index 5fa2e877..e5794b29 100644 --- a/src/clients/core/suspendedtickets.js +++ b/src/clients/core/suspendedtickets.js @@ -2,9 +2,7 @@ const {Client} = require('../client'); /** - * @class SuspendedTickets - * @description A thin wrapper around the Zendesk Suspended Tickets API - * @augments Client + * A thin wrapper around the Zendesk Suspended Tickets API * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/} */ class SuspendedTickets extends Client { @@ -16,7 +14,6 @@ class SuspendedTickets extends Client { /** * List all suspended tickets * @returns {Promise} Returns a promise that resolves to a list of suspended tickets - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#list-suspended-tickets} * @example const tickets = await client.suspendedtickets.list(); */ @@ -28,7 +25,6 @@ class SuspendedTickets extends Client { * Get details of a specific suspended ticket by ID * @param {number} suspendedTicketID - ID of the suspended ticket * @returns {Promise} Returns a promise that resolves to the details of the suspended ticket - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#show-suspended-ticket} * @example const ticket = await client.suspendedtickets.show(12345); */ @@ -40,7 +36,6 @@ class SuspendedTickets extends Client { * Recover a specific suspended ticket by ID * @param {number} suspendedTicketID - ID of the suspended ticket to recover * @returns {Promise} Returns a promise that resolves once the ticket has been recovered - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#recover-suspended-ticket} * @example await client.suspendedtickets.recover(12345); */ @@ -52,7 +47,6 @@ class SuspendedTickets extends Client { * Recover multiple suspended tickets by their IDs * @param {Array} suspendedTicketIDs - An array of suspended ticket IDs to recover * @returns {Promise} Returns a promise that resolves once the tickets have been recovered - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#recover-multiple-suspended-tickets} * @example await client.suspendedtickets.recoverMany([12345, 67890]); */ @@ -68,7 +62,6 @@ class SuspendedTickets extends Client { * Delete a specific suspended ticket by ID * @param {number} suspendedTicketID - ID of the suspended ticket to delete * @returns {Promise} Returns a promise that resolves once the ticket has been deleted - * @async * @throws Will throw an error if the request fails * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#delete-suspended-ticket} * @example await client.suspendedtickets.delete(12345); @@ -81,7 +74,6 @@ class SuspendedTickets extends Client { * Deletes multiple suspended tickets by their IDs * @param {Array} suspendedTicketIDs - An array of suspended ticket IDs to delete * @returns {Promise} Returns a promise that resolves once the tickets have been deleted - * @async * @throws Will throw an error if the request fails * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#delete-multiple-suspended-tickets} * @example await client.suspendedtickets.destroyMany([12345, 67890]); @@ -99,7 +91,6 @@ class SuspendedTickets extends Client { /** * @param {Array} suspendedTicketIDs - An array of suspended ticket IDs to delete * @returns {Promise} Returns a promise that resolves once the tickets have been deleted - * @async * @throws Will throw an error if the request fails * @example await client.suspendedtickets.deleteMany([12345, 67890]); * @deprecated Use `destroyMany` method instead. @@ -113,7 +104,6 @@ class SuspendedTickets extends Client { * Get attachments for a specific suspended ticket by ID * @param {number} suspendedTicketID - ID of the suspended ticket to get attachments from * @returns {Promise} Returns a promise that resolves to the attachments of the suspended ticket - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#suspended-ticket-attachments} * @example const attachments = await client.suspendedtickets.attachments(12345); */ @@ -124,7 +114,6 @@ class SuspendedTickets extends Client { /** * Export suspended tickets for the Zendesk Support instance * @returns {Promise} Returns a promise that resolves once the export request has been initiated - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#export-suspended-tickets} * @example await client.suspendedtickets.exportTickets(); */ diff --git a/src/clients/core/tags.js b/src/clients/core/tags.js index e58c1e76..063ed5ee 100644 --- a/src/clients/core/tags.js +++ b/src/clients/core/tags.js @@ -13,7 +13,6 @@ class Tags extends Client { /** * Retrieves all tags available to the user. * @returns {Promise} A promise that resolves with the list of tags. - * @async * @see {@link https://developer.zendesk.com/api-reference/sales-crm/resources/tags/#retrieve-all-tags} * @example * const client = createClient({...}); @@ -29,7 +28,6 @@ class Tags extends Client { * @param {string} tagData.name - Name of the tag. * @param {string} tagData.resource_type - Type of resource the tag is attached to (lead, contact, deal). * @returns {Promise} A promise that resolves with the created tag. - * @async * @throws Will throw an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/sales-crm/resources/tags/#create-a-tag} * @example @@ -44,7 +42,6 @@ class Tags extends Client { * Retrieves a single tag by its ID. * @param {number} id - Unique identifier of the tag. * @returns {Promise} A promise that resolves with the retrieved tag. - * @async * @throws Will throw an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/sales-crm/resources/tags/#retrieve-a-single-tag} * @example @@ -60,7 +57,6 @@ class Tags extends Client { * @param {number} id - Unique identifier of the tag. * @param {object} updatedData - Data to update. * @returns {Promise} A promise that resolves with the updated tag. - * @async * @throws Will throw an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/sales-crm/resources/tags/#update-a-tag} * @example @@ -75,7 +71,6 @@ class Tags extends Client { * Deletes a tag by its ID. * @param {number} id - Unique identifier of the tag. * @returns {Promise} A promise that resolves when the tag has been deleted. - * @async * @throws Will throw an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/sales-crm/resources/tags/#delete-a-tag} * @example diff --git a/src/clients/core/targetfailures.js b/src/clients/core/targetfailures.js index 33b1e171..503f8d14 100644 --- a/src/clients/core/targetfailures.js +++ b/src/clients/core/targetfailures.js @@ -14,7 +14,6 @@ class TargetFailures extends Client { /** * Lists the 25 most recent target failures, per target. * @returns {Array} An array of target failures. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/target_failures/#list-target-failures} * @example @@ -29,7 +28,6 @@ class TargetFailures extends Client { * Retrieves the details of a specific target failure by its ID. * @param {number} targetFailureID - The ID of the target failure. * @returns {object} The target failure details. - * @async * @throws {Error} Throws an error if the request fails or if the target failure ID is not found. * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/target_failures/#show-target-failure} * @example diff --git a/src/clients/core/targets.js b/src/clients/core/targets.js index c356cbe2..73d9c5ed 100644 --- a/src/clients/core/targets.js +++ b/src/clients/core/targets.js @@ -13,7 +13,6 @@ class Targets extends Client { /** * Lists all targets. * @returns {Promise} A promise that resolves to the list of targets. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#list-targets} * @example * const targets = await client.targets.list(); @@ -26,7 +25,6 @@ class Targets extends Client { * Retrieves details of a specific target. * @param {number} targetId - The ID of the target to retrieve. * @returns {Promise} A promise that resolves to the target details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#show-target} * @example * const target = await client.targets.show(12345); @@ -39,7 +37,6 @@ class Targets extends Client { * Creates a new target. * @param {object} target - The target data. * @returns {Promise} A promise that resolves to the created target's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#create-target} * @example * const target = { @@ -59,7 +56,6 @@ class Targets extends Client { * @param {number} targetId - The ID of the target to update. * @param {object} target - The updated target data. * @returns {Promise} A promise that resolves to the updated target's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#update-target} * @example * const updatedData = { email: 'updated@example.com' }; @@ -73,7 +69,6 @@ class Targets extends Client { * Deletes a specific target. * @param {number} targetId - The ID of the target to delete. * @returns {Promise} A promise that resolves once the target has been deleted. - * @async * @throws {Error} Throws an error if deletion fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#delete-target} * @example diff --git a/src/clients/core/ticketaudits.js b/src/clients/core/ticketaudits.js index 2d0b00bd..c592201b 100644 --- a/src/clients/core/ticketaudits.js +++ b/src/clients/core/ticketaudits.js @@ -17,7 +17,6 @@ class TicketAudits extends Client { /** * List all ticket audits. Note: Archived tickets are not included. * @returns {Promise>} Returns an array of ticket audit objects. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_audits/#list-all-ticket-audits} * @example @@ -32,7 +31,6 @@ class TicketAudits extends Client { * List all audits for a specified ticket. * @param {number} ticketID - The ID of the ticket. * @returns {Promise>} Returns an array of ticket audit objects. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_audits/#list-audits-for-a-ticket} * @example @@ -47,7 +45,6 @@ class TicketAudits extends Client { * Get an approximate count of audits for a specified ticket. * @param {number} ticketID - The ID of the ticket. * @returns {Promise} Returns an approximate count of audits. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_audits/#count-audits-for-a-ticket} * @example @@ -63,7 +60,6 @@ class TicketAudits extends Client { * @param {number} ticketID - The ID of the ticket. * @param {number} auditID - The ID of the ticket audit. * @returns {Promise} Returns details of the ticket audit. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_audits/#show-audit} * @example @@ -79,7 +75,6 @@ class TicketAudits extends Client { * @param {number} ticketID - The ID of the ticket. * @param {number} auditID - The ID of the ticket audit. * @returns {Promise} Returns the updated ticket audit details. - * @async * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_audits/#change-a-comment-from-public-to-private} * @example diff --git a/src/clients/core/ticketevents.js b/src/clients/core/ticketevents.js index 832cebb9..c66cf2c6 100644 --- a/src/clients/core/ticketevents.js +++ b/src/clients/core/ticketevents.js @@ -16,7 +16,6 @@ class TicketEvents extends Client { * @param {number} startTime - The time to start the incremental export from. * @param {string} include - Additional entities to include in the response. * @returns {Promise} Returns the result of the API call. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-ticket-event-export} * @example const result = await client.ticketevents.incrementalInclude(1632505559, 'comment_events'); @@ -33,7 +32,6 @@ class TicketEvents extends Client { * Fetches incremental ticket events. * @param {number} startTime - The time to start the incremental export from. * @returns {Promise} Returns the result of the API call. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-ticket-event-export} * @example const result = await client.ticketevents.incremental(1632505559); @@ -50,7 +48,6 @@ class TicketEvents extends Client { * Fetches a sample of ticket events for testing purposes. * @param {number} startTime - The time to start the incremental export from. * @returns {Promise} Returns the result of the API call. - * @async * @throws {Error} Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-sample-export} * @example const result = await client.ticketevents.incrementalSample(1632505559); diff --git a/src/clients/core/ticketexport.js b/src/clients/core/ticketexport.js index 73787890..4f69fc2e 100644 --- a/src/clients/core/ticketexport.js +++ b/src/clients/core/ticketexport.js @@ -14,7 +14,6 @@ class TicketExport extends Client { * Export tickets that changed since the provided start time using the time-based approach. * @param {number} start_time - The time to start the incremental export from. * @returns {Promise} Returns the response from the Zendesk API. - * @async * @throws Will throw an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-ticket-export-time-based} * @example const tickets = await client.ticketexport.export(1332034771); @@ -27,7 +26,6 @@ class TicketExport extends Client { * Export tickets with associated users and groups since the provided start time. * @param {number} start_time - The time to start the incremental export from. * @returns {Promise} Returns the response from the Zendesk API with users and groups included. - * @async * @throws Will throw an error if the request fails. * @example const ticketsWithUsers = await client.ticketexport.exportWithUser(1332034771); */ @@ -45,7 +43,6 @@ class TicketExport extends Client { * @param {string} startTime - The start time for exporting incremental tickets. * @param {string} include - Optional parameters to include in the export. * @returns {Promise} A promise that resolves with an array of exported incremental tickets. - * @async * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#ticket-export-incremental-include} * @example @@ -67,7 +64,6 @@ class TicketExport extends Client { * @param {number} start_time - The time to start the incremental export from. * @param {string} [cursor] - The cursor pointer for subsequent requests. * @returns {Promise} Returns the response from the Zendesk API. - * @async * @throws Will throw an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-ticket-export-cursor-based} * @example const cursorTickets = await client.ticketexport.exportCursor(1332034771, 'MTU3NjYxMzUzOS4wfHw0NTF8'); @@ -79,7 +75,6 @@ class TicketExport extends Client { /** * @param {number} ticketID - The ID of the ticket. * @returns {Promise} Returns the list of audits for the ticket. - * @async * @throws Will throw an error if the request fails. * @example const ticketAudits = await client.ticketexport.exportAudit(12345); * @deprecated Use the `list` method from the `TicketAudits` class instead. @@ -94,7 +89,6 @@ class TicketExport extends Client { Export a sample of tickets based on a specified start time. * @param {string} startTime - The start time for exporting the sample of tickets. * @returns {Promise} A promise that resolves with the exported sample of tickets. - * @async * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-sample-export} * @example diff --git a/src/clients/core/ticketfields.js b/src/clients/core/ticketfields.js index cbbda62d..ea195db2 100644 --- a/src/clients/core/ticketfields.js +++ b/src/clients/core/ticketfields.js @@ -48,7 +48,6 @@ class TicketFields extends Client { /** * Lists all ticket fields. * @returns {Promise>}} Returns an array of ticket fields. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields} * @example @@ -63,7 +62,6 @@ class TicketFields extends Client { * Lists all ticket fields with locale. * @param {string} locale - The locale code to filter ticket fields (e.g., 'sv' for Swedish). * @returns {Promise>}} Returns an array of ticket fields by locale. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields} * @example @@ -78,7 +76,6 @@ class TicketFields extends Client { * Retrieves a specific ticket field by ID. * @param {number} ticketFieldId - The ID of the ticket field to retrieve. * @returns {Promise} Returns the details of the ticket field. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#show-ticket-field} * @example @@ -92,7 +89,6 @@ class TicketFields extends Client { /** * Retrieves the count of ticket fields. * @returns {Promise} Returns the count of ticket fields. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#count-ticket-fields} * @example @@ -107,7 +103,6 @@ class TicketFields extends Client { * Creates a new ticket field. * @param {object} ticketField - The properties of the ticket field to create. * @returns {Promise} Returns the created ticket field. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#create-ticket-field} * @example @@ -126,7 +121,6 @@ class TicketFields extends Client { * @param {number} ticketFieldId - The ID of the ticket field to update. * @param {object} ticketField - The updated properties of the ticket field. * @returns {Promise} Returns the updated ticket field. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#update-ticket-field} * @example @@ -143,7 +137,6 @@ class TicketFields extends Client { * Deletes a specific ticket field by ID. * @param {number} ticketFieldId - The ID of the ticket field to delete. * @returns {Promise} - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#delete-ticket-field} * @example @@ -158,7 +151,6 @@ class TicketFields extends Client { * Lists all options of a ticket field. * @param {number} ticketFieldId - The ID of the ticket field to retrieve options from. * @returns {Promise} Returns an array of options for the ticket field. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-field-options} * @example @@ -174,7 +166,6 @@ class TicketFields extends Client { * @param {number} ticketFieldId - The ID of the ticket field. * @param {number} optionID - The ID of the option to retrieve. * @returns {Promise} Returns the option details. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#show-ticket-field-option} * @example @@ -190,7 +181,6 @@ class TicketFields extends Client { * @param {number} ticketFieldId - The ID of the ticket field. * @param {object} option - The properties of the option to create or update. * @returns {Promise} Returns the created or updated option. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#create-or-update-ticket-field-option} * @example @@ -211,7 +201,6 @@ class TicketFields extends Client { * @param {number} ticketFieldId - The ID of the ticket field. * @param {number} optionID - The ID of the option to delete. * @returns {Promise} - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#delete-ticket-field-option} * @example diff --git a/src/clients/core/ticketforms.js b/src/clients/core/ticketforms.js index 3bda1e10..56d04de6 100644 --- a/src/clients/core/ticketforms.js +++ b/src/clients/core/ticketforms.js @@ -2,8 +2,7 @@ const {Client} = require('../client'); /** - * @class - * @classdesc Client for interacting with the Zendesk TicketForms API. + * Client for interacting with the Zendesk TicketForms API. * @see {@link https://developer.zendesk.com/rest_api/docs/support#ticket-forms} */ class TicketForms extends Client { @@ -20,7 +19,6 @@ class TicketForms extends Client { * @param {boolean} [options.end_user_visible] - true returns ticket forms where end_user_visible; false returns ticket forms that are not end-user visible. If not present, returns both. * @param {boolean} [options.fallback_to_default] - true returns the default ticket form when the criteria defined by the parameters results in a set without active and end-user visible ticket forms. * @returns {Promise} An array of ticket forms. - * @async * @throws {Error} Throws an error if there is an issue with the API call. * @see {@link https://developer.zendesk.com/rest_api/docs/support#list-ticket-forms} * @example @@ -36,7 +34,6 @@ class TicketForms extends Client { * Retrieve a specific ticket form by its ID. * @param {number} ticketFormID - The ID of the ticket form to retrieve. * @returns {Promise} The requested ticket form. - * @async * @throws {Error} Throws an error if there is an issue with the API call. * @see {@link https://developer.zendesk.com/rest_api/docs/support#show-ticket-form} * @example @@ -51,7 +48,6 @@ class TicketForms extends Client { * Creates a new Ticket Form. * @param {object} ticketForm - The ticket form object to be created. * @returns {Promise} - A promise that resolves to the created ticket form. - * @async * @throws {Error} - Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_forms/#create-ticket-form} * @example @@ -71,7 +67,6 @@ class TicketForms extends Client { * @param {number} ticketFormID - The ID of the ticket form to update. * @param {object} ticketForm - The updated ticket form object. * @returns {Promise} The updated ticket form. - * @async * @throws {Error} Throws an error if there is an issue with the API call. * @see {@link https://developer.zendesk.com/rest_api/docs/support#update-ticket-form} * @example @@ -86,7 +81,6 @@ class TicketForms extends Client { * Deletes a Ticket Form by its ID. * @param {number} ticketFormID - The ID of the ticket form to be deleted. * @returns {Promise} - A promise that resolves when the ticket form is deleted. - * @async * @throws {Error} - Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_forms/#delete-ticket-form} * @example @@ -101,7 +95,6 @@ class TicketForms extends Client { * @param {number} ticketFormID - The ID of the ticket form to be cloned. * @param {boolean} [prependCloneTitle=false] - Whether to prepend the title with "Clone of" or not. * @returns {Promise} - A promise that resolves to the cloned ticket form details. - * @async * @throws {Error} - Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_forms/#clone-an-already-existing-ticket-form} * @example @@ -118,7 +111,6 @@ class TicketForms extends Client { * Reorders the specified Ticket Forms based on the provided array of IDs. * @param {number[]} ticketFormIDs - An array of ticket form IDs in the desired order. * @returns {Promise} - A promise that resolves to the reordered ticket forms' details. - * @async * @throws {Error} - Throws an error if the API call fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_forms/#reorder-ticket-forms} * @example diff --git a/src/clients/core/ticketimport.js b/src/clients/core/ticketimport.js index 2f799e4a..3af51d28 100644 --- a/src/clients/core/ticketimport.js +++ b/src/clients/core/ticketimport.js @@ -23,7 +23,6 @@ class TicketImport extends Client { * @param {string} ticket.subject - The subject of the ticket. * @param {Array} ticket.tags - Array of tags associated with the ticket. * @returns {Promise} The response from the Zendesk API. - * @async * @throws {Error} Throws an error if the request to the Zendesk API fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/#ticket-import} * @example @@ -44,7 +43,6 @@ class TicketImport extends Client { /** * @param {number} ticketID - The ID of the ticket to fetch the audits for. * @returns {Promise} An array of ticket audits from the Zendesk API. - * @async * @throws {Error} Throws an error if the request to the Zendesk API fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/} * @example @@ -59,15 +57,15 @@ class TicketImport extends Client { /** * Bulk imports multiple tickets into Zendesk. - * @param {Array} tickets - An array containing ticket data to be imported. Accepts up to 100 ticket objects. - * @param {number} tickets[].assignee_id - The ID of the user to assign this ticket to. - * @param {Array} tickets[].comments - Array of comments associated with the ticket. - * @param {string} tickets[].description - The description of the ticket. - * @param {number} tickets[].requester_id - The ID of the user requesting the ticket. - * @param {string} tickets[].subject - The subject of the ticket. - * @param {Array} tickets[].tags - Array of tags associated with the ticket. + * @param {Array} tickets - An array containing ticket data to be imported. Each ticket should include the following fields: + * - `assignee_id` (number): The ID of the user to assign this ticket to. + * - `comments` (Array): Array of comments associated with the ticket. + * - `description` (string): The description of the ticket. + * - `requester_id` (number): The ID of the user requesting the ticket. + * - `subject` (string): The subject of the ticket. + * - `tags` (Array): Array of tags associated with the ticket. + * **Note**: While these fields are required for each ticket object, they are not directly accessed within this function. The entire array of tickets is passed to the Zendesk API. * @returns {Promise} The response from the Zendesk API, including a job status object. - * @async * @throws {Error} Throws an error if the request to the Zendesk API fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/#ticket-bulk-import} * @example diff --git a/src/clients/core/ticketmetrics.js b/src/clients/core/ticketmetrics.js index a19713a2..19d90ee5 100644 --- a/src/clients/core/ticketmetrics.js +++ b/src/clients/core/ticketmetrics.js @@ -14,7 +14,6 @@ class TicketMetrics extends Client { * Lists the Ticket Metrics for a specific ticket. * @param {number} ticketID - The ID of the ticket. * @returns {Promise} The ticket metrics data. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metrics/#show-ticket-metrics} * @example @@ -28,7 +27,6 @@ class TicketMetrics extends Client { /** * Lists all Ticket Metrics. * @returns {Promise} An array of all ticket metrics data. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metrics/#list-ticket-metrics} * @example @@ -43,7 +41,6 @@ class TicketMetrics extends Client { * Shows a specific Ticket Metric by its ID. * @param {number} ticketMetricId - The ID of the ticket metric to retrieve. * @returns {Promise} The ticket metric data. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metrics/#show-ticket-metrics} * @example diff --git a/src/clients/core/tickets.js b/src/clients/core/tickets.js index 3bb06634..341ec42c 100644 --- a/src/clients/core/tickets.js +++ b/src/clients/core/tickets.js @@ -2,9 +2,10 @@ const {Client} = require('../client'); /** - * @typedef {object} RecursivePartial + * A recursive type that makes all properties of an object optional, including nested objects. * @template T - * @property {T[P]} [P] - The property of the object. + * @typedef {object} RecursivePartial + * @property {Partial<{[K in keyof T]: RecursivePartial}>} [key] - A recursive partial property of T. */ /** @@ -134,8 +135,7 @@ const {Client} = require('../client'); */ class Tickets extends Client { /** - * @constructs Tickets - * @param {import('../client').ZendeskClientOptions} options - The client options. + * @param {import('../client').ClientOptions} options - The client options. */ constructor(options) { super(options); @@ -156,7 +156,6 @@ class Tickets extends Client { /** * List all the tickets. * @returns {Promise>} An array of tickets. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const tickets = await client.tickets.list(); @@ -169,7 +168,6 @@ class Tickets extends Client { * List all tickets assigned to a specific user. * @param {number} userID - The ID of the user. * @returns {Promise>} An array of tickets assigned to the user. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const assignedTickets = await client.tickets.listAssigned(12345); @@ -182,7 +180,6 @@ class Tickets extends Client { * List all tickets associated with a specific organization. * @param {number} orgID - The ID of the organization. * @returns {Promise>} An array of tickets under the organization. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const orgTickets = await client.tickets.listByOrganization(6789); @@ -195,7 +192,6 @@ class Tickets extends Client { * List all tickets requested by a specific user. * @param {number} userID - The ID of the user. * @returns {Promise>} An array of tickets requested by the user. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const requestedTickets = await client.tickets.listByUserRequested(12345); @@ -208,7 +204,6 @@ class Tickets extends Client { * List all tickets where a specific user is CC'd. * @param {number} userID - The ID of the user. * @returns {Promise>} An array of tickets where the user is CC'd. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const ccdTickets = await client.tickets.listByUserCCD(12345); @@ -222,7 +217,6 @@ class Tickets extends Client { * @param {string} type - Type of filter. * @param {string|number} value - Value for the filter. * @returns {Promise>} An array of tickets matching the filter. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const filteredTickets = await client.tickets.listWithFilter('status', 'open'); @@ -234,7 +228,6 @@ class Tickets extends Client { /** * List recently viewed tickets by the requesting agent. * @returns {Promise>} An array of recently viewed tickets. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const recentTickets = await client.tickets.listRecent(); @@ -247,7 +240,6 @@ class Tickets extends Client { * List collaborators of a specific ticket. * @param {number} ticketId - The ID of the ticket. * @returns {Promise} An array of collaborators for the ticket. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const collaborators = await client.tickets.listCollaborators(7890); @@ -260,7 +252,6 @@ class Tickets extends Client { * List incidents related to a specific ticket. * @param {number} ticketId - The ID of the ticket. * @returns {Promise} An array of incidents related to the ticket. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const incidents = await client.tickets.listIncidents(7890); @@ -273,7 +264,6 @@ class Tickets extends Client { * Retrieve metrics for a specific ticket. * @param {number} ticketId - The ID of the ticket. * @returns {Promise} Metrics details for the ticket. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const metrics = await client.tickets.listMetrics(7890); @@ -286,7 +276,6 @@ class Tickets extends Client { * Retrieve a specific ticket by its ID. * @param {number} ticketId - The ID of the ticket. * @returns {Promise<{result: Ticket}>} Details of the ticket. - * @async * @throws {Error} If the ticket ID is not provided or invalid. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-ticket} * @example @@ -300,7 +289,6 @@ class Tickets extends Client { * Retrieve details for multiple tickets based on their IDs. * @param {Array} ticketIds - An array of ticket IDs to fetch. * @returns {Promise>} An array of ticket details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-multiple-tickets} * @example * const ticketsDetails = await client.tickets.showMany([123, 456, 789]); @@ -313,7 +301,6 @@ class Tickets extends Client { * Create a new ticket. * @param {CreateOrUpdateTicket} ticket - Details of the ticket to be created. * @returns {Promise<{result: Ticket}>} The created ticket details. - * @async * @throws {Error} If the ticket details are not provided or invalid. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#create-ticket} * @example @@ -327,7 +314,6 @@ class Tickets extends Client { * Create multiple new tickets. * @param {CreateManyTickets} tickets - An object of tickets containing an array of tickets. * @returns {Promise>} A promise that resolves to an array of created ticket objects. - * @async * @throws {Error} If the provided `tickets` is not an array or is empty. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#create-many-tickets} * @example @@ -349,7 +335,6 @@ class Tickets extends Client { * @param {number} ticketId - The ID of the ticket to update. * @param {CreateOrUpdateTicket} ticket - The updated ticket data as an 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} * @example @@ -369,7 +354,6 @@ class Tickets extends Client { * @param {Array} ticketIds - An array of ticket IDs to update. * @param {object} ticket - The updated ticket data as an object. * @returns {Promise} A promise that resolves to the updated ticket object. - * @async * @throws {Error} If `ticketIds` is not an array of numbers or if `ticket` is not an object. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-many-tickets} * @example @@ -389,7 +373,6 @@ class Tickets extends Client { * Delete a ticket by its ID. * @param {number} ticketId - The ID of the ticket to delete. * @returns {Promise} A promise that resolves when the ticket is successfully deleted. - * @async * @throws {Error} If `ticketId` is not a number or is not provided. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket} * @example @@ -405,7 +388,6 @@ class Tickets extends Client { * Delete multiple tickets by their IDs. * @param {Array} ticketIds - An array of ticket IDs to delete. * @returns {Promise} A promise that resolves when the tickets are successfully deleted. - * @async * @throws {Error} If `ticketIds` is not an array of valid ticket IDs. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#bulk-delete-tickets} * @example @@ -422,7 +404,6 @@ class Tickets extends Client { * @param {number} ticketId - The ID of the ticket to be merged. * @param {object} mergedTicket - The ticket object representing the ticket to merge with. * @returns {Promise} A promise that resolves with the merged ticket object. - * @async * @throws {Error} If `ticketId` is not a valid ticket ID or `mergedTicket` is not a valid ticket object. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#merge-tickets} * @example @@ -445,7 +426,6 @@ class Tickets extends Client { * Export tickets based on a specified start time. * @param {string} startTime - The start time for exporting tickets. * @returns {Promise} A promise that resolves with the exported tickets. - * @async * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#ticket-export} * @example @@ -464,7 +444,6 @@ class Tickets extends Client { * Export a sample of tickets based on a specified start time. * @param {string} startTime - The start time for exporting the sample of tickets. * @returns {Promise} A promise that resolves with the exported sample of tickets. - * @async * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/#incremental-sample-export} * @example @@ -483,7 +462,6 @@ class Tickets extends Client { * Export incremental tickets based on a specified start time. * @param {string} startTime - The start time for exporting incremental tickets. * @returns {Promise} A promise that resolves with an array of exported incremental tickets. - * @async * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#ticket-export-incremental} * @example @@ -503,7 +481,6 @@ class Tickets extends Client { * @param {string} startTime - The start time for exporting incremental tickets. * @param {string} include - Optional parameters to include in the export. * @returns {Promise} A promise that resolves with an array of exported incremental tickets. - * @async * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#ticket-export-incremental-include} * @example @@ -527,7 +504,6 @@ class Tickets extends Client { * Export a sample of incremental tickets based on a specified start time. * @param {string} startTime - The start time for exporting the sample of incremental tickets. * @returns {Promise} A promise that resolves with an array of exported incremental tickets. - * @async * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#ticket-export-incremental-sample} * @example @@ -549,7 +525,6 @@ class Tickets extends Client { * Retrieve comments associated with a specific ticket. * @param {number} ticketId - The ID of the ticket to retrieve comments for. * @returns {Promise} A promise that resolves with an array of comments associated with the ticket. - * @async * @throws {Error} If `ticketId` is not a valid number. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/} * @example @@ -565,7 +540,6 @@ class Tickets extends Client { * Retrieve audits associated with a specific ticket. (Deprecated: Use TicketAudits class list method instead) * @param {number} ticketId - The ID of the ticket to retrieve audits for. * @returns {Promise} A promise that resolves with an array of audits associated with the ticket. - * @async * @throws {Error} If `ticketId` is not a valid number. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#listing-ticket-audits} * @example @@ -583,7 +557,6 @@ class Tickets extends Client { * @param {number} ticketId - The ID of the ticket to add tags to. * @param {Array} tags - An array of tags to add to the ticket. * @returns {Promise} A promise that resolves when the tags are successfully added to the ticket. - * @async * @throws {Error} If `ticketId` is not a valid number or `tags` is not an array of strings. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#updating-tag-lists} * @example @@ -601,7 +574,6 @@ class Tickets extends Client { * @param {number} ticketId - The ID of the ticket to replace tags on. * @param {Array} tags - An array of new tags to replace the existing tags on the ticket. * @returns {Promise} A promise that resolves when the tags are successfully replaced on the ticket. - * @async * @throws {Error} If `ticketId` is not a valid number or `tags` is not an array of strings. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#updating-tag-lists} * @example diff --git a/src/clients/core/triggers.js b/src/clients/core/triggers.js index c3e657b6..bd168de0 100644 --- a/src/clients/core/triggers.js +++ b/src/clients/core/triggers.js @@ -15,7 +15,6 @@ class Triggers extends Client { * Searches for triggers based on the provided search term. * @param {string} searchTerm - The term to search for. * @returns {Promise} The search results. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#search-triggers} * @example const results = await client.triggers.search('exampleTerm'); @@ -27,7 +26,6 @@ class Triggers extends Client { /** * Retrieves trigger definitions. * @returns {Promise} The trigger definitions. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#list-trigger-action-and-condition-definitions} * @example const definitions = await client.triggers.definitions(); @@ -44,7 +42,6 @@ class Triggers extends Client { * @param {string} [options.sort_by] - Possible values are "alphabetical", "created_at", "updated_at", "usage_1h", "usage_24h", or "usage_7d". Defaults to "position". * @param {string} [options.sort_order] - One of "asc" or "desc". Defaults to "asc" for alphabetical and position sort, "desc" for all others. * @returns {Promise} A list of all triggers. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#list-triggers} * @example @@ -58,7 +55,6 @@ class Triggers extends Client { /** * Lists all active triggers. * @returns {Promise} A list of all active triggers. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#list-active-triggers} * @example const activeTriggers = await client.triggers.listActive(); @@ -71,7 +67,6 @@ class Triggers extends Client { * Retrieves details of a specific trigger. * @param {number} triggerID - The ID of the trigger. * @returns {Promise} Details of the specified trigger. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#show-trigger} * @example const triggerDetails = await client.triggers.show(12345); @@ -84,7 +79,6 @@ class Triggers extends Client { * Creates a new trigger. * @param {object} trigger - The trigger object to be created. * @returns {Promise} The created trigger. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#create-trigger} * @example @@ -104,7 +98,6 @@ class Triggers extends Client { * @param {number} triggerID - The ID of the trigger to be updated. * @param {object} trigger - The updated trigger object. * @returns {Promise} The updated trigger. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#update-trigger} * @example @@ -123,7 +116,6 @@ class Triggers extends Client { * Updates multiple triggers. * @param {Array} triggers - An array of trigger objects to be updated. * @returns {Promise} The response from the update request. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#update-many-triggers} * @example @@ -141,7 +133,6 @@ class Triggers extends Client { * Deletes a specified trigger. * @param {number} triggerID - The ID of the trigger to be deleted. * @returns {Promise} The response from the deletion request. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#delete-trigger} * @example const response = await client.triggers.delete(12345); @@ -154,7 +145,6 @@ class Triggers extends Client { * Deletes multiple triggers based on their IDs. * @param {Array} triggerIDs - An array of trigger IDs to be deleted. * @returns {Promise} The response from the deletion request. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#bulk-delete-triggers} * @example const response = await client.triggers.bulkDelete([12345, 67890]); @@ -173,7 +163,6 @@ class Triggers extends Client { * Reorders the triggers based on the provided trigger IDs. * @param {Array} triggerIDs - An array of trigger IDs in the desired order. * @returns {Promise} The response from the reorder request. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#reorder-triggers} * @example const response = await client.triggers.reorder([12345, 67890, 11223]); @@ -188,7 +177,6 @@ class Triggers extends Client { * Lists the revisions associated with a trigger. * @param {number} triggerID - The ID of the trigger. * @returns {Promise} A list of revisions for the specified trigger. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#list-trigger-revisions} * @example const revisions = await client.triggers.listRevisions(12345); @@ -202,7 +190,6 @@ class Triggers extends Client { * @param {number} triggerID - The ID of the trigger. * @param {number} revisionID - The ID of the revision. * @returns {Promise} Details of the specified trigger revision. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#show-trigger-revision} * @example const revisionDetails = await client.triggers.showRevision(12345, 67890); diff --git a/src/clients/core/userfields.js b/src/clients/core/userfields.js index 9496d8ae..d5db0dba 100644 --- a/src/clients/core/userfields.js +++ b/src/clients/core/userfields.js @@ -13,7 +13,6 @@ class UserFields extends Client { /** * Lists all custom user fields in the account. * @returns {Promise} The list of user fields. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#list-user-fields} * @example const userFields = await client.userfields.list(); */ @@ -25,7 +24,6 @@ class UserFields extends Client { * Retrieves details of a specific user field. * @param {number} userFieldID - The ID of the user field. * @returns {Promise} Details of the user field. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#show-user-field} * @example const userField = await client.userfields.show(12345); */ @@ -37,7 +35,6 @@ class UserFields extends Client { * Creates a new user field. * @param {object} userField - The user field data. * @returns {Promise} The created user field. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#create-user-field} * @example const newUserField = await client.userfields.create({ type: 'text', title: 'Support description' }); */ @@ -50,7 +47,6 @@ class UserFields extends Client { * @param {number} userFieldID - The ID of the user field. * @param {object} userField - The updated user field data. * @returns {Promise} The updated user field. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#update-user-field} * @example await client.userfields.update(12345, { title: 'Updated Support description' }); */ @@ -62,7 +58,6 @@ class UserFields extends Client { * Deletes a user field. * @param {number} userFieldID - The ID of the user field. * @returns {Promise} The response from the delete operation. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#delete-user-field} * @example await client.userfields.delete(12345); */ @@ -74,7 +69,6 @@ class UserFields extends Client { * Reorders the user fields based on the provided IDs. * @param {Array} userFieldIDs - An array of user field IDs in the desired order. * @returns {Promise} The reordered user fields. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#reorder-user-field} * @example await client.userfields.reorder([3, 4]); */ @@ -86,7 +80,6 @@ class UserFields extends Client { * Lists options for a specific dropdown user field. * @param {number} userFieldID - The ID of the user field. * @returns {Promise} The list of user field options. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#list-user-field-options} * @example const options = await client.userfields.listOptions(12345); */ @@ -99,7 +92,6 @@ class UserFields extends Client { * @param {number} userFieldID - The ID of the user field. * @param {number} userFieldOptionID - The ID of the user field option. * @returns {Promise} Details of the user field option. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#show-a-user-field-option} * @example const option = await client.userfields.showOption(12345, 67890); */ @@ -112,7 +104,6 @@ class UserFields extends Client { * @param {number} userFieldID - The ID of the user field. * @param {object} customFieldOption - The user field option data. * @returns {Promise} The created or updated user field option. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#create-or-update-a-user-field-option} * @example await client.userfields.createOrUpdateOption(12345, { name: 'Grapes', position: 2, value: 'grape' }); */ @@ -128,7 +119,6 @@ class UserFields extends Client { * @param {number} userFieldID - The ID of the user field. * @param {number} userFieldOptionID - The ID of the user field option. * @returns {Promise} The response from the delete operation. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#delete-user-field-option} * @example await client.userfields.deleteOption(12345, 67890); */ diff --git a/src/clients/core/useridentities.js b/src/clients/core/useridentities.js index cccb401b..8bf6c15f 100644 --- a/src/clients/core/useridentities.js +++ b/src/clients/core/useridentities.js @@ -14,7 +14,6 @@ class UserIdentities extends Client { * List all identities for a given user. * @param {number} userId - The ID of the user. * @returns {Promise} A list of user identities. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#list-identities} * @example const identities = await client.useridentities.list(12345); @@ -28,7 +27,6 @@ class UserIdentities extends Client { * @param {number} userId - The ID of the user. * @param {number} userIdentityId - The ID of the user identity to show. * @returns {Promise} The user identity details. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#show-identity} * @example const identity = await client.useridentities.show(12345, 67890); @@ -42,7 +40,6 @@ class UserIdentities extends Client { * @param {number} userId - The ID of the user. * @param {object} userIdentity - The user identity details to create. * @returns {Promise} The created user identity. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#create-identity} * @example const newIdentity = await client.useridentities.create(12345, {type: 'email', value: 'test@example.com'}); @@ -66,7 +63,6 @@ class UserIdentities extends Client { * @param {number} userIdentityId - The ID of the user identity to update. * @param {object} identity - The updated identity details. * @returns {Promise} The updated user identity. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#update-identity} * @example const updatedIdentity = await client.useridentities.update(12345, 67890, {verified: true}); @@ -80,7 +76,6 @@ class UserIdentities extends Client { * @param {number} userId - The ID of the user. * @param {number} userIdentityId - The ID of the user identity to make primary. * @returns {Promise} The updated user identity. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#make-identity-primary} * @example await client.useridentities.makePrimary(12345, 67890); @@ -100,7 +95,6 @@ class UserIdentities extends Client { * @param {number} userId - The ID of the user. * @param {number} userIdentityId - The ID of the user identity to verify. * @returns {Promise} The verified user identity. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#verify-identity} * @example await client.useridentities.verify(12345, 67890); @@ -114,7 +108,6 @@ class UserIdentities extends Client { * @param {number} userId - The ID of the user. * @param {number} userIdentityId - The ID of the user identity to request verification for. * @returns {Promise} The user identity verification request details. - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#request-user-verification} * @example await client.useridentities.requestVerification(12345, 67890); @@ -134,7 +127,6 @@ class UserIdentities extends Client { * @param {number} userId - The ID of the user. * @param {number} userIdentityId - The ID of the user identity to delete. * @returns {Promise} - * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_identities/#delete-identity} * @example await client.useridentities.delete(12345, 67890); diff --git a/src/clients/core/users.js b/src/clients/core/users.js index b393333f..0136e9fd 100644 --- a/src/clients/core/users.js +++ b/src/clients/core/users.js @@ -74,7 +74,6 @@ class Users extends Client { /** * Authenticates the current user. * @returns {Promise} The authenticated user's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-the-currently-authenticated-user} * @example * const user = await client.users.auth(); @@ -86,7 +85,6 @@ class Users extends Client { /** * Lists all users. * @returns {Promise>} An array of user objects. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#list-users} * @example * const users = await client.users.list(); @@ -100,7 +98,6 @@ class Users extends Client { * @param {string} type - The type of filter. * @param {string|number} value - The value for the filter. * @returns {Promise>} An array of user objects. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#list-users} * @example * const users = await client.users.listWithFilter('type', 'value'); @@ -113,7 +110,6 @@ class Users extends Client { * Lists users by group ID. * @param {number} id - The ID of the group. * @returns {Promise>} An array of user objects. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#list-users} * @example * const users = await client.users.listByGroup(12345); @@ -126,7 +122,6 @@ class Users extends Client { * Lists users by organization ID. * @param {number} id - The ID of the organization. * @returns {Promise>} An array of user objects. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#list-users} * @example * const users = await client.users.listByOrganization(12345); @@ -139,7 +134,6 @@ class Users extends Client { * Shows details of a user by ID. * @param {number} id - The ID of the user. * @returns {Promise<{result: User}>} The user's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user} * @example * const user = await client.users.show(12345); @@ -152,7 +146,6 @@ class Users extends Client { * Shows details of multiple users by their IDs. * @param {Array} userIds - An array of user IDs. * @returns {Promise>} An array of user details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-many-users} * @example * const users = await client.users.showMany([12345, 67890]); @@ -165,7 +158,6 @@ class Users extends Client { * Creates a new user. * @param {object} user - The user details. * @returns {Promise} The created user's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#create-user} * @example * const newUser = await client.users.create({name: 'John Doe', email: 'john@example.com'}); @@ -178,7 +170,6 @@ class Users extends Client { * Creates multiple users. * @param {Array} users - An array of user details. * @returns {Promise>} An array of created user details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#create-many-users} * @example * const newUsers = await client.users.createMany([{name: 'John Doe', email: 'john@example.com'}, {name: 'Jane Smith', email: 'jane@example.com'}]); @@ -191,7 +182,6 @@ class Users extends Client { * Creates or updates a user. * @param {object} user - The user details. * @returns {Promise} 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: 'john@example.com'}); @@ -204,7 +194,6 @@ class Users extends Client { * Creates or updates multiple users. * @param {Array} users - An array of user details. * @returns {Promise>} An array of created or updated user details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#create-or-update-many-users} * @example * const users = await client.users.createOrUpdateMany([{name: 'John Doe', email: 'john@example.com'}, {name: 'Jane Smith', email: 'jane@example.com'}]); @@ -218,7 +207,6 @@ class Users extends Client { * @param {number} id - The ID of the user. * @param {object} user - The updated user details. * @returns {Promise} The updated user's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#update-user} * @example * const updatedUser = await client.users.update(12345, {name: 'Johnathan Doe'}); @@ -231,7 +219,6 @@ class Users extends Client { * Updates multiple users. * @param {...*} args - Arguments including optional IDs and user details. * @returns {Promise>} An array of updated user details. - * @async * @throws {Error} Throws an error if not enough arguments are provided. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#update-many-users} * @example @@ -292,7 +279,6 @@ class Users extends Client { * Suspends a user by ID. * @param {number} id - The ID of the user to suspend. * @returns {Promise} The suspended user's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#suspend-user} * @example * await client.users.suspend(12345); @@ -305,7 +291,6 @@ class Users extends Client { * Unsuspends a user by ID. * @param {number} id - The ID of the user to unsuspend. * @returns {Promise} The unsuspended user's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#unsuspend-user} * @example * await client.users.unsuspend(12345); @@ -318,7 +303,6 @@ class Users extends Client { * Deletes a user by ID. * @param {number} id - The ID of the user to delete. * @returns {Promise} - * @async * @throws {Error} Throws an error if the user cannot be deleted. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#delete-user} * @example @@ -332,7 +316,6 @@ class Users extends Client { * Deletes multiple users. * @param {...*} args - Arguments including optional IDs and user details. * @returns {Promise} - * @async * @throws {Error} Throws an error if not enough arguments are provided. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#delete-many-users} * @example @@ -393,7 +376,6 @@ class Users extends Client { * Searches for users based on specific parameters. * @param {object} parameters - The search parameters. * @returns {Promise>} An array of user objects that match the search criteria. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#search-users} * @example * const users = await client.users.search({query: 'john@example.com'}); @@ -405,7 +387,6 @@ class Users extends Client { /** * Retrieves details of the currently authenticated user. * @returns {Promise<{result: User}>} The user's details.The authenticated user's details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-the-currently-authenticated-user} * @example * const user = await client.users.me(); @@ -419,7 +400,6 @@ class Users extends Client { * @param {number} id - The ID of the user to be merged. * @param {number} targetId - The ID of the user into which the first user will be merged. * @returns {Promise} The details of the merged user. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#merge-user-into-another-user} * @example * await client.users.merge(12345, 67890); @@ -434,7 +414,6 @@ class Users extends Client { * @param {string} oldPassword - The current password of the user. * @param {string} newPassword - The new password for the user. * @returns {Promise} The user's details after the password change. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#change-password} * @example * await client.users.password(12345, 'oldPassword123', 'newPassword456'); @@ -451,7 +430,6 @@ class Users extends Client { * @param {number} startTime - The start time for the incremental export. * @param {string} include - The related data to include. * @returns {Promise>} An array of user objects with included data. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#incremental-export-users} * @example * const users = await client.users.incrementalInclude(1632614395, 'relatedData'); @@ -468,7 +446,6 @@ class Users extends Client { * Retrieves users incrementally. * @param {number} startTime - The start time for the incremental export. * @returns {Promise>} An array of user objects. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#incremental-export-users} * @example * const users = await client.users.incremental(1632614395); @@ -481,7 +458,6 @@ class Users extends Client { * Retrieves a sample of users incrementally. * @param {number} startTime - The start time for the incremental export. * @returns {Promise>} A sample array of user objects. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#incremental-sample-export-users} * @example * const usersSample = await client.users.incrementalSample(1632614395); @@ -499,7 +475,6 @@ class Users extends Client { * Lists tags associated with a user. * @param {number} userId - The ID of the user. * @returns {Promise>} An array of tags associated with the user. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user-tags/#list-tags} * @example * const tags = await client.users.listTags(12345); @@ -513,7 +488,6 @@ class Users extends Client { * @param {number} userId - The ID of the user. * @param {Array} tags - An array of tags to set for the user. * @returns {Promise} The user's details with the updated tags. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user-tags/#set-tags} * @example * await client.users.setTags(12345, ['tag1', 'tag2']); @@ -527,7 +501,6 @@ class Users extends Client { * @param {number} userId - The ID of the user. * @param {Array} tags - An array of tags to add to the user. * @returns {Promise} The user's details with the added tags. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user-tags/#add-tags} * @example * await client.users.addTags(12345, ['tag3', 'tag4']); @@ -541,7 +514,6 @@ class Users extends Client { * @param {number} userId - The ID of the user. * @param {Array} tags - An array of tags to remove from the user. * @returns {Promise} - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user-tags/#remove-tags} * @example * await client.users.removeTags(12345, ['tag3', 'tag4']); diff --git a/src/clients/core/views.js b/src/clients/core/views.js index 5a569a2e..f8aee06b 100644 --- a/src/clients/core/views.js +++ b/src/clients/core/views.js @@ -14,7 +14,6 @@ class Views extends Client { /** * Lists shared and personal views available to the current user. * @returns {Promise} A promise that resolves to the list of views. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-views} * @example * const views = await client.views.list(); @@ -26,7 +25,6 @@ class Views extends Client { /** * Lists active shared and personal views available to the current user. * @returns {Promise} A promise that resolves to the list of active views. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-active-views} * @example * const activeViews = await client.views.listActive(); @@ -38,7 +36,6 @@ class Views extends Client { /** * A compacted list of shared and personal views available to the current user. * @returns {Promise} A promise that resolves to the compact list of views. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-views-compact} * @example * const compactViews = await client.views.listCompact(); @@ -51,7 +48,6 @@ class Views extends Client { * Shows details of a specific view. * @param {number} viewID - The ID of the view to retrieve. * @returns {Promise} A promise that resolves to the details of the view. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view} * @example * const viewDetails = await client.views.show(12345); @@ -64,7 +60,6 @@ class Views extends Client { * Creates a new view. * @param {object} view - The view data to create. * @returns {Promise} A promise that resolves to the created view details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#create-view} * @example * const newView = { @@ -82,7 +77,6 @@ class Views extends Client { * @param {number} viewID - The ID of the view to update. * @param {object} viewData - The updated view data. * @returns {Promise} A promise that resolves to the updated view details. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#update-view} * @example * const updatedData = { @@ -99,7 +93,6 @@ class Views extends Client { * @param {number} viewID - The ID of the view to execute. * @param {object} parameters - Additional parameters for execution. * @returns {Promise} A promise that resolves to the executed view results. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#execute-view} * @example const executedView = await client.views.execute(12345, {sort_by: 'status'}); */ @@ -111,7 +104,6 @@ class Views extends Client { * Retrieves tickets from a specific view by its ID. * @param {number} viewID - The ID of the view. * @returns {Promise} A promise that resolves to the list of tickets from the view. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-tickets-from-a-view} * @example const ticketsFromView = await client.views.tickets(12345); */ @@ -123,7 +115,6 @@ class Views extends Client { * Previews a new view without saving it. * @param {object} parameters - Additional parameters for execution. * @returns {Promise} A promise that resolves to the previewed view results. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#preview-view} * @example * const viewData = { @@ -140,7 +131,6 @@ class Views extends Client { * Retrieves the count of tickets for a specific view. * @param {number} viewID - The ID of the view to count tickets for. * @returns {Promise} A promise that resolves to the ticket count for the view. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view-count} * @example const ticketCount = await client.views.showCount(12345); */ @@ -152,7 +142,6 @@ class Views extends Client { * Retrieves the ticket counts for multiple views. * @param {Array} viewIDs - An array of view IDs to count tickets for. * @returns {Promise} A promise that resolves to the ticket counts for the specified views. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-multiple-view-counts} * @example const ticketCounts = await client.views.showCounts([12345, 67890]); */ @@ -164,7 +153,6 @@ class Views extends Client { * Exports views to a JSON file. * @param {number} viewID - The ID of the view to export. * @returns {Promise} A promise that resolves to the exported views in JSON format. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#export-view} * @example const exportedViews = await client.views.export([12345, 67890]); */ @@ -175,7 +163,6 @@ class Views extends Client { /** * Retrieves all active shared views. * @returns {Promise} A promise that resolves to the list of all active shared views. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-active-shared-views} */ async listActiveShared() { @@ -186,7 +173,6 @@ class Views extends Client { * Retrieves the view's execution status. * @param {number} viewID - The ID of the view to check the execution status for. * @returns {Promise} A promise that resolves to the execution status of the view. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view-execution-status} */ async showExecutionStatus(viewID) { @@ -197,7 +183,6 @@ class Views extends Client { * Retrieves the view's recent ticket IDs. * @param {number} viewID - The ID of the view to retrieve recent ticket IDs for. * @returns {Promise} A promise that resolves to the recent ticket IDs of the view. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view-recent-ticket-ids} */ async showRecentTicketIDs(viewID) { @@ -208,7 +193,6 @@ class Views extends Client { * Deletes a specific view by its ID. * @param {number} viewID - The ID of the view to delete. * @returns {Promise} A promise that resolves when the view is deleted. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#delete-view} */ async delete(viewID) { @@ -219,7 +203,6 @@ class Views extends Client { * Reorders views based on the provided order. * @param {Array} viewOrder - An array of view IDs in the desired order. * @returns {Promise} A promise that resolves when the views are reordered. - * @async * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#reorder-views} */ async reorder(viewOrder) { diff --git a/src/clients/core/webhooks.js b/src/clients/core/webhooks.js index 0c98a0b4..0a133f55 100644 --- a/src/clients/core/webhooks.js +++ b/src/clients/core/webhooks.js @@ -15,7 +15,6 @@ class Webhooks extends Client { /** * List all webhooks. * @returns {Promise} A promise that resolves to the list of webhooks. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhooks} * @example const webhooks = await client.webhooks.list(); */ @@ -27,7 +26,6 @@ class Webhooks extends Client { * Retrieve a specific webhook by ID. * @param {string} webhookID - The ID of the webhook to retrieve. * @returns {Promise} A promise that resolves to the specified webhook. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#show-webhook} * @example const webhook = await client.webhooks.show('webhookID123'); */ @@ -39,7 +37,6 @@ class Webhooks extends Client { * Create a new webhook. * @param {object} webhook - The webhook data to create. * @returns {Promise} A promise that resolves to the created webhook. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#create-or-clone-webhook} * @example * const newWebhook = { @@ -56,7 +53,6 @@ class Webhooks extends Client { * @param {string} webhookID - The ID of the webhook to update. * @param {object} webhook - The updated webhook data. * @returns {Promise} A promise that resolves to the updated webhook. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#update-webhook} * @example * const updatedData = { @@ -72,7 +68,6 @@ class Webhooks extends Client { * Delete a specific webhook by ID. * @param {string} webhookID - The ID of the webhook to delete. * @returns {Promise} A promise that resolves when the webhook is deleted. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#delete-webhook} * @example await client.webhooks.delete('webhookID123'); */ @@ -87,7 +82,6 @@ class Webhooks extends Client { * @param {object} request - The request data for testing the webhook. * @param {string} [webhookID] - The ID of the webhook to be tested (for existing webhooks). * @returns {Promise} A promise that resolves to the test result. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#test-webhook} * @example * const requestData = { @@ -106,7 +100,6 @@ class Webhooks extends Client { * List invocations for a specific webhook. * @param {string} webhookID - The ID of the webhook. * @returns {Promise} A promise that resolves to the list of invocations. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhook-invocations} * @example const invocations = await client.webhooks.listInvocations('webhookID123'); */ @@ -119,7 +112,6 @@ class Webhooks extends Client { * @param {string} webhookID - The ID of the webhook. * @param {string} invocationID - The ID of the webhook invocation. * @returns {Promise} A promise that resolves to the list of invocation attempts. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhook-invocation-attempts} * @example const attempts = await client.webhooks.listInvocationAttempts('webhookID123', 'invocationID123'); */ @@ -137,7 +129,6 @@ class Webhooks extends Client { * Retrieve the signing secret of a specific webhook. * @param {string} webhookID - The ID of the webhook. * @returns {Promise} A promise that resolves to the signing secret. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#show-webhook-signing-secret} * @example const secret = await client.webhooks.getSigningSecret('webhookID123'); */ @@ -149,7 +140,6 @@ class Webhooks extends Client { * Reset the signing secret for a specific webhook. * @param {string} webhookID - The ID of the webhook. * @returns {Promise} A promise that resolves to the new signing secret. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#reset-webhook-signing-secret} * @example const newSecret = await client.webhooks.resetSigningSecret('webhookID123'); */ @@ -162,7 +152,6 @@ class Webhooks extends Client { * @param {string} webhookID - The ID of the webhook to patch. * @param {object} webhook - The data to patch. * @returns {Promise} A promise that resolves to the patched webhook. - * @async * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#patch-webhook} * @example * const patchData = { diff --git a/src/clients/helpcenter/index.js b/src/clients/helpcenter/index.js index 70c3d752..30b21455 100644 --- a/src/clients/helpcenter/index.js +++ b/src/clients/helpcenter/index.js @@ -1,5 +1,7 @@ /** - * @private + * Manages help center for the Zendesk client. + * + * This class provides access to various help center-related functionality within the Zendesk API. */ class ZendeskClientHelpcenter { /** diff --git a/src/clients/services/index.js b/src/clients/services/index.js index eed0800c..d6b53453 100644 --- a/src/clients/services/index.js +++ b/src/clients/services/index.js @@ -1,8 +1,11 @@ /** - * @private + * Manages services for the Zendesk client. + * + * This class provides access to various service-related functionality within the Zendesk API. */ class ZendeskClientServices { /** + * Creates a new instance of ZendeskClientServices. * @param {import('../../index.js').ZendeskClient} client - The Zendesk client instance. */ constructor(client) { @@ -10,10 +13,10 @@ class ZendeskClientServices { } /** + * Instantiates a new service class. * @template T * @param {new (options: import('../../index.js').ZendeskClientOptions) => T} className - The class to instantiate. * @returns {T} An instance of the provided class. - * @private */ _instantiate(className) { return this.client._instantiate(className); diff --git a/src/clients/throttle.js b/src/clients/throttle.js index be54aa28..08f220ac 100644 --- a/src/clients/throttle.js +++ b/src/clients/throttle.js @@ -5,12 +5,12 @@ module.exports = throttle; * The throttled function ensures that the wrapped function is not invoked more frequently * than a specified time interval. * @param {...any} args - The arguments for the throttled function. This can include: - * - {Function} fn: The function to be throttled. - * - {object} [options]: Throttling options. - * - {number|string} [options.interval]: The time interval in milliseconds between function calls. - * - {number} [options.window=1]: The sliding window duration in which 'limit' number of calls are allowed. - * - {number} [options.limit=1]: The maximum number of function calls allowed in the specified window. - * - {...any} additionalArgs: Additional arguments to be passed to the throttled function. + * - `fn` (Function): The function to be throttled. + * - `options` (object, optional): Throttling options. + * - `options.interval` (number|string, optional): The time interval in milliseconds between function calls. + * - `options.window` (number, default=1): The sliding window duration in which 'limit' number of calls are allowed. + * - `options.limit` (number, default=1): The maximum number of function calls allowed in the specified window. + * - `additionalArgs` (...any): Additional arguments to be passed to the throttled function. * @returns {Function} - A throttled function that queues and limits the execution of the original function. * @example * const throttledLog = throttle(console.log, 1000); // Throttle to at most 1 call per second diff --git a/src/clients/voice/index.js b/src/clients/voice/index.js index 281553e1..a922b801 100644 --- a/src/clients/voice/index.js +++ b/src/clients/voice/index.js @@ -1,5 +1,7 @@ /** - * @private + * Manages voice for the Zendesk client. + * + * This class provides access to various voice-related functionality within the Zendesk API. */ class ZendeskClientVoice { /** diff --git a/src/index.js b/src/index.js index 8bdea199..181e626c 100644 --- a/src/index.js +++ b/src/index.js @@ -31,22 +31,21 @@ const {ZendeskClientVoice} = require('./clients/voice'); /** * Represents the main client to interface with the Zendesk API. * This class acts as a high-level interface, making it easier to interact with specific Zendesk APIs. - * @class + * @class ZendeskClient * @property {ZendeskClientOptions} config - Configuration options for the client. * @property {ConsoleLogger} logger - Logger for logging. + * @example + * const zendeskOptions = { + * username: 'exampleUser', + * token: 'exampleToken', + * subdomain: 'mycompany' + * }; + * const zendeskClient = createClient(zendeskOptions); + * const data = await zendeskClient.someResource.someMethod(); */ class ZendeskClient { /** - * @constructs ZendeskClient * @param {ZendeskClientOptions} options - Configuration options for the client. - * @example - * const zendeskOptions = { - * username: 'exampleUser', - * token: 'exampleToken', - * subdomain: 'mycompany' - * }; - * const zendeskClient = createClient(zendeskOptions); - * const data = await zendeskClient.someResource.someMethod(); */ constructor(options = {}) { this.config = options; @@ -353,7 +352,6 @@ class ZendeskClient { /** * Creates and returns an instance of the ZendeskClient class. - * @function * @param {ZendeskClientOptions} options - Configuration options for the Zendesk client. * @returns {ZendeskClient} An instance of the ZendeskClient class. */