diff --git a/src/clients/core/accountsettings.js b/src/clients/core/accountsettings.js index 9438f89..6540504 100644 --- a/src/clients/core/accountsettings.js +++ b/src/clients/core/accountsettings.js @@ -14,7 +14,7 @@ class AccountSettings extends Client { /** * Retrieves the account settings. - * @returns {Promise} A promise that resolves to the account settings. + * @returns {Promise<{response: object, result: object}>} 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}. * @example * const settings = await client.accountsettings.show(); @@ -26,7 +26,7 @@ class AccountSettings extends Client { /** * Updates the account settings. * @param {object} settings - The settings to update. - * @returns {Promise} A promise that resolves to the updated account settings. + * @returns {Promise<{response: object, result: object}>} 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}. * @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 5342388..943944c 100644 --- a/src/clients/core/activitystream.js +++ b/src/clients/core/activitystream.js @@ -34,7 +34,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the activity object corresponding to the provided activityID. * @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. @@ -50,7 +50,7 @@ class ActivityStream extends Client { * The count[refreshed_at] property is a timestamp that indicates when the count was last updated. * 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to an object containing the activity count and the refreshed_at timestamp. * @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 4dd82da..658eb61 100644 --- a/src/clients/core/attachments.js +++ b/src/clients/core/attachments.js @@ -58,7 +58,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns the details of the attachment. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#show-attachment} * @example * const attachmentDetails = await client.attachments.show(12345); @@ -96,7 +96,7 @@ class Attachments extends Client { * Toggles enabling or restricting agent access to attachments with detected malware. * @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. + * @returns {Promise<{response: object, result: object}>} The response from the Zendesk API. * @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 298fa77..923ed18 100644 --- a/src/clients/core/automations.js +++ b/src/clients/core/automations.js @@ -38,7 +38,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns details of the automation. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#show-automation} * @example const automationDetails = await client.automations.show(123456); */ @@ -49,7 +49,7 @@ class Automations extends Client { /** * Create a new automation. * @param {object} automationData - Data for the new automation. - * @returns {Promise} Returns the created automation. + * @returns {Promise<{response: object, result: object}>} Returns the created automation. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#create-automation} * @example * const automation = await client.automations.create({ @@ -66,7 +66,7 @@ class Automations extends Client { * Update an existing automation. * @param {number} automationID - ID of the automation to update. * @param {object} updatedData - Updated data for the automation. - * @returns {Promise} Returns the updated automation. + * @returns {Promise<{response: object, result: object}>} Returns the updated automation. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#update-automation} * @example * const updatedAutomation = await client.automations.update(12345, { @@ -80,7 +80,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns the status of the bulk update. * @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}]); diff --git a/src/clients/core/brand.js b/src/clients/core/brand.js index 76c757d..07ba882 100644 --- a/src/clients/core/brand.js +++ b/src/clients/core/brand.js @@ -12,7 +12,7 @@ class Brand extends Client { /** * List all brands. - * @returns {Promise} The list of brands. + * @returns {Promise<{response: object, result: Array}>} The list of brands. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#list-brands} * @example const brands = await client.brands.list(); */ @@ -23,7 +23,7 @@ class Brand extends Client { /** * Show a specific brand by ID. * @param {number} brandId - The ID of the brand. - * @returns {Promise} The brand details. + * @returns {Promise<{response: object, result: object}>} The brand details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#show-a-brand} * @example const brand = await client.brands.show(47); */ @@ -34,7 +34,7 @@ class Brand extends Client { /** * Create a new brand. * @param {object} brand - The brand data. - * @returns {Promise} The created brand details. + * @returns {Promise<{response: object, result: object}>} The created brand details. * @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"}); */ @@ -46,7 +46,7 @@ class Brand extends Client { * Update an existing brand. * @param {object} brand - The updated brand data. * @param {number} brandId - The ID of the brand to update. - * @returns {Promise} The updated brand details. + * @returns {Promise<{response: object, result: object}>} The updated brand details. * @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); */ @@ -69,7 +69,7 @@ class Brand extends Client { * Check host mapping validity for a given subdomain and host mapping. * @param {string} hostMapping - The host mapping to check. * @param {string} subdomain - The subdomain to check. - * @returns {Promise} The check result. + * @returns {Promise<{response: object, result: object}>} The check result. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#check-host-mapping-validity} * @example await client.brands.checkHostMapping("brand1.com", "brand1"); */ @@ -84,7 +84,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The check result. * @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 97a0399..8cf067c 100644 --- a/src/clients/core/customagentroles.js +++ b/src/clients/core/customagentroles.js @@ -26,7 +26,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns a promise that resolves with the specified custom agent role. * @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 @@ -40,7 +40,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The created custom agent role. * @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 @@ -59,7 +59,7 @@ class CustomAgentRoles extends Client { * Updates an existing custom agent role. * @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. + * @returns {Promise<{response: object, result: object}>} The updated custom agent role. * @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 diff --git a/src/clients/core/dynamiccontent.js b/src/clients/core/dynamiccontent.js index 9e8edbb..2ce3b8d 100644 --- a/src/clients/core/dynamiccontent.js +++ b/src/clients/core/dynamiccontent.js @@ -17,7 +17,7 @@ class DynamicContent extends Client { /** * Lists the dynamic content items. - * @returns {Promise} The dynamic content items. + * @returns {Promise<{response: object, result: Array}>} The dynamic content items. * @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(); @@ -39,7 +39,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The specified dynamic content item. * @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); @@ -51,7 +51,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} Returns the fetched dynamic content items. * @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 @@ -68,7 +68,7 @@ class DynamicContent extends Client { /** * Creates a new dynamic content item. * @param {object} item - The item to create. - * @returns {Promise} The created dynamic content item. + * @returns {Promise<{response: object, result: object}>} The created dynamic content item. * @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: [...]}); @@ -81,7 +81,7 @@ class DynamicContent extends Client { * Updates a specific dynamic content item. * @param {number} itemID - The ID of the dynamic content item. * @param {object} item - The updated item details. - * @returns {Promise} The updated dynamic content item. + * @returns {Promise<{response: object, result: object}>} The updated dynamic content item. * @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"}); diff --git a/src/clients/core/dynamiccontentvariants.js b/src/clients/core/dynamiccontentvariants.js index 8a1243a..53942ed 100644 --- a/src/clients/core/dynamiccontentvariants.js +++ b/src/clients/core/dynamiccontentvariants.js @@ -16,7 +16,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} The variants of the specified content item. * @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 @@ -30,7 +30,7 @@ class DynamicContentVariants extends Client { * Fetches the details of a specified dynamic content variant. * @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. + * @returns {Promise<{response: object, result: object}>} Returns the dynamic content variant details. * @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 @@ -51,7 +51,7 @@ class DynamicContentVariants extends Client { * Creates a new dynamic content variant. * @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. + * @returns {Promise<{response: object, result: object}>} Returns the details of the created variant. * @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 @@ -73,7 +73,7 @@ class DynamicContentVariants extends Client { * @param {number} itemID - The ID of the dynamic content item. * @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. + * @returns {Promise<{response: object, result: object}>} Returns the details of the updated variant. * @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 @@ -116,7 +116,7 @@ class DynamicContentVariants extends Client { * Creates multiple variants for a dynamic content item. * @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. + * @returns {Promise<{response: object, result: object}>} A confirmation of the creation. * @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 @@ -133,7 +133,7 @@ class DynamicContentVariants extends Client { * Updates multiple variants of a dynamic content item. * @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. + * @returns {Promise<{response: object, result: object}>} A confirmation of the update. * @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 2601f22..d674e19 100644 --- a/src/clients/core/groupmemberships.js +++ b/src/clients/core/groupmemberships.js @@ -55,7 +55,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Details of the group membership. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#show-membership} * @example * const membershipDetails = await client.groupmemberships.show(123); @@ -68,7 +68,7 @@ class GroupMemberships extends Client { * Show details of a group membership by user ID. * @param {number} userID - The ID of the user. * @param {number} groupMembershipID - The ID of the group membership. - * @returns {Promise} Details of the group membership. + * @returns {Promise<{response: object, result: object}>} Details of the group membership. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#show-membership} * @example * const membershipDetails = await client.groupmemberships.showByUser(123, 456); @@ -80,7 +80,7 @@ class GroupMemberships extends Client { /** * Create a new group membership. * @param {object} groupMembership - The group membership details. - * @returns {Promise} The created group membership. + * @returns {Promise<{response: object, result: object}>} The created group membership. * @throws {Error} Throws an error if the creation fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#create-membership} * @example @@ -94,7 +94,7 @@ class GroupMemberships extends Client { * Create a new group membership by user ID. * @param {number} userID - The ID of the user. * @param {object} groupMembership - The group membership details. - * @returns {Promise} The created group membership. + * @returns {Promise<{response: object, result: object}>} The created group membership. * @throws {Error} Throws an error if the creation fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#create-membership} * @example @@ -140,7 +140,7 @@ class GroupMemberships extends Client { * Set a group membership as default. * @param {number} userID - The ID of the user. * @param {number} groupMembershipID - The ID of the group membership. - * @returns {Promise} Updated group membership. + * @returns {Promise<{response: object, result: object}>} Updated group membership. * @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 @@ -184,7 +184,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Job status indicating the progress of the bulk create operation. * @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 diff --git a/src/clients/core/groups.js b/src/clients/core/groups.js index e2eebc4..6386cdf 100644 --- a/src/clients/core/groups.js +++ b/src/clients/core/groups.js @@ -56,7 +56,7 @@ class Groups extends Client { /** * Retrieves an approximate count of groups. * If the count exceeds 100,000, it is updated every 24 hours. - * @returns {Promise} A promise that resolves to the group count data. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the group count data. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/groups/#count-groups} * @example @@ -69,7 +69,7 @@ class Groups extends Client { /** * Retrieves the approximate count of groups for a specified user. * @param {number} userID - The ID of the user for whom to count the groups. - * @returns {Promise} A promise that resolves to the approximate count of groups for the user. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the approximate count of groups for the user. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/groups/#count-groups} * @example @@ -94,7 +94,7 @@ class Groups extends Client { /** * Retrieves details of a specific group by its ID. * @param {number} groupID - The ID of the group. - * @returns {Promise<{result: Group}>} A promise that resolves to the group's details. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the group's details. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/groups/#show-group} * @example @@ -107,7 +107,7 @@ class Groups extends Client { /** * Creates a new group. * @param {CreateOrUpdateGroup} group - The group details to create. - * @returns {Promise<{result: Group}>} A promise that resolves to the details of the created group. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the details of the created group. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/groups/#create-group} * @example @@ -125,7 +125,7 @@ class Groups extends Client { * Updates a specified group. * @param {number} groupID - The ID of the group to update. * @param {CreateOrUpdateGroup} group - The updated group details. - * @returns {Promise<{result: Group}>} A promise that resolves to the details of the updated group. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the details of the updated group. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/groups/groups/#update-group} * @example diff --git a/src/clients/core/imports.js b/src/clients/core/imports.js index 573ee04..76e334e 100644 --- a/src/clients/core/imports.js +++ b/src/clients/core/imports.js @@ -14,7 +14,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The response from the Zendesk API. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_import/#ticket-import} * @example diff --git a/src/clients/core/installations.js b/src/clients/core/installations.js index c84fcbc..cef74ce 100644 --- a/src/clients/core/installations.js +++ b/src/clients/core/installations.js @@ -23,7 +23,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The app installation details as an object. * @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 @@ -37,7 +37,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The response data from creating the app installation. * @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 @@ -57,7 +57,7 @@ class Installations extends Client { * Updates a specific app installation. * @param {number} installationID - The ID of the app installation. * @param {object} installation - The updated installation data. - * @returns {Promise} Returns the response from Zendesk API. + * @returns {Promise<{response: object, result: object}>} Returns the response from Zendesk API. * @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 diff --git a/src/clients/core/jobstatuses.js b/src/clients/core/jobstatuses.js index 9e49bc4..3b589a2 100644 --- a/src/clients/core/jobstatuses.js +++ b/src/clients/core/jobstatuses.js @@ -15,7 +15,7 @@ class JobStatuses extends Client { /** * Retrieves a list of job statuses. - * @returns {Promise>} - A promise that resolves to a list of job statuses. + * @returns {Promise<{response: object, result: Array}>} - A promise that resolves to a list of job statuses. * @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 @@ -28,7 +28,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the job status data. * @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 @@ -41,7 +41,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} - A promise that resolves to a list of job statuses. * @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 diff --git a/src/clients/core/locales.js b/src/clients/core/locales.js index f2d5f3a..bd0555d 100644 --- a/src/clients/core/locales.js +++ b/src/clients/core/locales.js @@ -27,7 +27,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Details of the specified locale. * @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 @@ -40,7 +40,7 @@ class Locales extends Client { /** * Retrieves the locale information of the currently logged-in user. - * @returns {Promise} Details of the current user's locale. + * @returns {Promise<{response: object, result: object}>} Details of the current user's locale. * @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 @@ -53,7 +53,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Details of the current user's locale. * @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 @@ -93,7 +93,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Best detected locale for the user. * @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 ce9d90d..655457f 100644 --- a/src/clients/core/macros.js +++ b/src/clients/core/macros.js @@ -26,7 +26,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns a promise that resolves to the macro's details. * @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 @@ -39,7 +39,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} - A promise that resolves to a list of matched macros. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#search-macros} * @example @@ -51,7 +51,7 @@ class Macros extends Client { /** * Lists all active macros. - * @returns {Promise>} - A promise that resolves to a list of active macros. + * @returns {Promise<{response: object, result: Array}>} - A promise that resolves to a list of active macros. * @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 @@ -77,7 +77,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the applied macro's result. * @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 @@ -91,7 +91,7 @@ class Macros extends Client { * Creates a macro representation derived from a ticket. * @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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the macro replica. * @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 @@ -108,7 +108,7 @@ class Macros extends Client { * @param {string} macro.title - The title of the macro. * @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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the created macro. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#create-macro} * @example @@ -137,7 +137,7 @@ class Macros extends Client { * Updates an existing macro. * @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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the updated macro. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#update-macro} * @example @@ -165,7 +165,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} - A promise that resolves to an array of updated macros. * @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 5f0c941..9a41099 100644 --- a/src/clients/core/oauthclients.js +++ b/src/clients/core/oauthclients.js @@ -25,7 +25,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The OAuth client details. * @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); @@ -37,7 +37,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The details of the created OAuth client. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#create-client} * @example @@ -55,7 +55,7 @@ class OAuthClients extends Client { * Updates a specific OAuth client by ID. * @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. + * @returns {Promise<{response: object, result: object}>} The updated OAuth client details. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_clients/#update-client} * @example @@ -83,7 +83,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The new client secret. * @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 415dda4..33813b4 100644 --- a/src/clients/core/oauthtokens.js +++ b/src/clients/core/oauthtokens.js @@ -14,7 +14,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The OAuth token details. * @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); @@ -25,7 +25,7 @@ class OAuthTokens extends Client { /** * Retrieves the details of the currently authenticated OAuth token. - * @returns {Promise} The details of the currently authenticated OAuth token. + * @returns {Promise<{response: object, result: object}>} The details of the currently authenticated OAuth token. * @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(); @@ -60,7 +60,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The details of the created OAuth token. * @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 c2c9d07..7a6eb29 100644 --- a/src/clients/core/organizationfields.js +++ b/src/clients/core/organizationfields.js @@ -24,7 +24,7 @@ class OrganizationFields extends Client { /** * Show a specific organization field. * @param {number} organizationFieldID - The ID of the organization field. - * @returns {Promise} The organization field details. + * @returns {Promise<{response: object, result: object}>} The organization field details. * @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); @@ -36,7 +36,7 @@ class OrganizationFields extends Client { /** * Create a new organization field. * @param {object} organizationField - The organization field object. - * @returns {Promise} The newly created organization field. + * @returns {Promise<{response: object, result: object}>} The newly created organization field. * @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' }); */ @@ -48,7 +48,7 @@ class OrganizationFields extends Client { * Update an existing organization field. * @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. + * @returns {Promise<{response: object, result: object}>} The updated organization field. * @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' }); */ @@ -74,7 +74,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The reordered organization fields. * @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 66162c6..e849cf7 100644 --- a/src/clients/core/organizationmemberships.js +++ b/src/clients/core/organizationmemberships.js @@ -13,7 +13,7 @@ class OrganizationMemberships extends Client { /** * List all organization memberships. - * @returns {Promise} A promise resolving to an array of organization memberships. + * @returns {Promise>} A promise resolving to an array of organization memberships. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#list-memberships} * @example * const memberships = await client.organizationmemberships.list(); @@ -25,7 +25,7 @@ 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. + * @returns {Promise>} A promise resolving to an array of organization memberships for the user. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#list-memberships} * @example * const memberships = await client.organizationmemberships.listByUser(123); @@ -37,7 +37,7 @@ 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. + * @returns {Promise>} A promise resolving to an array of organization memberships for the organization. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#list-memberships} * @example * const memberships = await client.organizationmemberships.listByOrganization(456); @@ -53,7 +53,7 @@ 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. + * @returns {Promise<{response: object, result: OrganizationMembership}>} A promise resolving to the organization membership. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#show-membership} * @example * const membership = await client.organizationmemberships.show(789); @@ -66,7 +66,7 @@ class OrganizationMemberships extends Client { * Retrieve a specific organization membership by user ID and membership ID. * @param {number} userID - The user ID. * @param {number} organizationMembershipID - The organization membership ID. - * @returns {Promise} A promise resolving to the organization membership. + * @returns {Promise<{response: object, result: OrganizationMembership}>} A promise resolving to the organization membership. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organization_memberships/#show-membership} * @example * const membership = await client.organizationmemberships.showByUser(123, 789); @@ -83,7 +83,7 @@ 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. + * @returns {Promise<{response: object, result: OrganizationMembership}>} A promise resolving to the created organization membership. * @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 }); @@ -99,7 +99,7 @@ class OrganizationMemberships extends Client { * @param {number} userID - The user ID. * @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. + * @returns {Promise<{response: object, result: OrganizationMembership}>} A promise resolving to the created organization membership. * @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 }); @@ -121,7 +121,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise resolving to a job status. * @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 }, ...]); @@ -182,7 +182,7 @@ class OrganizationMemberships extends Client { * Set a specific organization membership as the default for a user. * @param {number} userID - The user ID. * @param {number} organizationMembershipID - The organization membership ID. - * @returns {Promise} A promise resolving to the updated organization membership. + * @returns {Promise<{response: object, result: OrganizationMembership}>} A promise resolving to the updated organization membership. * @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 d093ed3..a0c9f9c 100644 --- a/src/clients/core/organizations.js +++ b/src/clients/core/organizations.js @@ -64,7 +64,7 @@ class Organizations extends Client { /** * Retrieves related information for a specific organization. * @param {number} organizationID - The ID of the organization. - * @returns {Promise} Object containing related information of the organization. + * @returns {Promise<{response: object, result: object}>} Object containing related information of the organization. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organizations-related-information} * @example const relatedInfo = await client.organizations.related(12345); */ @@ -75,7 +75,7 @@ class Organizations extends Client { /** * Views a specific organization by its ID. * @param {number} organizationID - The ID of the organization. - * @returns {Promise} The organization's details. + * @returns {Promise<{response: object, result: object}>} The organization's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organization} * @example const organization = await client.organizations.show(12345); */ @@ -120,7 +120,7 @@ class Organizations extends Client { /** * Creates a new organization. * @param {object} organization - The organization object to create. - * @returns {Promise} The created organization's details. + * @returns {Promise<{response: object, result: object}>} The created organization's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#create-organization} * @example const newOrganization = await client.organizations.create({ name: 'New Org' }); */ @@ -131,7 +131,7 @@ class Organizations extends Client { /** * Creates multiple organizations. * @param {object[]} organizations - An array of organization objects to create. - * @returns {Promise} Details of the created organizations. + * @returns {Promise<{response: object, result: object[]}>} Details of the created organizations. * @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' }]); */ @@ -142,7 +142,7 @@ class Organizations extends Client { /** * Creates or updates an organization. * @param {object} organization - The organization object to create or update. - * @returns {Promise} The created or updated organization's details. + * @returns {Promise<{response: object, result: object}>} The created or updated organization's details. * @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' }); */ @@ -154,7 +154,7 @@ class Organizations extends Client { * 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. + * @returns {Promise<{response: object, result: object}>} The updated organization's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#update-organization} * @example const updatedOrganization = await client.organizations.update(12345, { name: 'New Name' }); */ @@ -165,7 +165,7 @@ class Organizations extends Client { /** * Updates multiple organizations. * @param {object[]} organizations - An array of organization objects to update. - * @returns {Promise} Details of the updated organizations. + * @returns {Promise<{response: object, result: object[]}>} Details of the updated organizations. * @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' }]); */ @@ -176,7 +176,7 @@ class Organizations extends Client { /** * 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. + * @returns {Promise<{response: object, result: object}>} The created or updated organization's details. * @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' }); */ @@ -288,7 +288,7 @@ class Organizations extends Client { /** * 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. + * @returns {Promise<{response: object, result: object[]}>} Sample list of organizations in the incremental export. * @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 5d8bc22..25b2487 100644 --- a/src/clients/core/permissiongroups.js +++ b/src/clients/core/permissiongroups.js @@ -26,7 +26,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Permission group object. * @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 @@ -42,7 +42,7 @@ class PermissionGroups extends Client { * @param {string} group.name - Name of the permission group. * @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. + * @returns {Promise<{response: object, result: object}>} Newly created permission group object. * @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 @@ -63,7 +63,7 @@ class PermissionGroups extends Client { * @param {string} [group.name] - Name of the permission group. * @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. + * @returns {Promise<{response: object, result: object}>} Updated permission group object. * @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 diff --git a/src/clients/core/policies.js b/src/clients/core/policies.js index feed117..7e1669e 100644 --- a/src/clients/core/policies.js +++ b/src/clients/core/policies.js @@ -28,7 +28,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the policy details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#show-sla-policy} * @example const policyDetails = await client.policies.show(25); */ @@ -39,7 +39,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the newly created policy details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#create-sla-policy} * @example * const newPolicy = { @@ -57,7 +57,7 @@ class Policies extends Client { * Update an existing SLA Policy. * @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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the updated policy details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#update-sla-policy} * @example * const updatedPolicy = { @@ -85,7 +85,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The response from the Zendesk API. * @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 @@ -97,7 +97,7 @@ class Policies extends Client { /** * Retrieve a list of supported filter definition items. - * @returns {Promise} The response from the Zendesk API containing supported filter definitions. + * @returns {Promise<{response: object, result: object}>} The response from the Zendesk API containing supported filter definitions. * @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 104cc07..b76b379 100644 --- a/src/clients/core/requests.js +++ b/src/clients/core/requests.js @@ -111,7 +111,7 @@ class Requests extends Client { * Search for ticket requests. * @param {object} parameters - Search parameters. * @param {string} parameters.query - The query string. - * @returns {Promise} List of matching ticket requests. + * @returns {Promise<{response: object, result: object[]}>} List of matching ticket requests. * @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' }); @@ -123,7 +123,7 @@ class Requests extends Client { /** * Retrieve a specific ticket request. * @param {number} requestId - The ID of the ticket request. - * @returns {Promise} The ticket request details. + * @returns {Promise<{response: object, result: object}>} The ticket request details. * @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); @@ -135,7 +135,7 @@ class Requests extends Client { /** * Retrieve a specific ticket request. * @param {number} requestId - The ID of the ticket request. - * @returns {Promise} The ticket request details. + * @returns {Promise<{response: object, result: object}>} The ticket request details. * @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); @@ -148,7 +148,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The created ticket request details. * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#create-request} * @example @@ -168,7 +168,7 @@ class Requests extends Client { * Update an existing ticket request. * @param {number} requestId - The ID of the ticket request. * @param {object} updateDetails - Details to update. - * @returns {Promise} The updated ticket request details. + * @returns {Promise<{response: object, result: object}>} The updated ticket request details. * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-requests/#update-request} * @example diff --git a/src/clients/core/satisfactionratings.js b/src/clients/core/satisfactionratings.js index b916f1f..a3333c9 100644 --- a/src/clients/core/satisfactionratings.js +++ b/src/clients/core/satisfactionratings.js @@ -36,7 +36,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Details of the satisfaction rating. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/satisfaction_ratings/#show-satisfaction-rating} * @example const ratingDetails = await client.satisfactionratings.show(12345); */ @@ -48,7 +48,7 @@ class SatisfactionRatings extends Client { * Creates a satisfaction rating for a ticket. * @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. + * @returns {Promise<{response: object, result: object}>} The created satisfaction rating. * @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 @@ -67,7 +67,7 @@ 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. + * @returns {Promise<{response: object, result: object[]}>} A list of satisfaction ratings from the specified start time. * @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 30a1ccd..6712939 100644 --- a/src/clients/core/search.js +++ b/src/clients/core/search.js @@ -14,7 +14,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A JSON object with the search results. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#list-search-results} * @example * const results = await client.search.query('open tickets'); @@ -37,7 +37,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A JSON object with the search results. * @example * const anonResults = await client.search.queryAnonymous('open tickets'); */ @@ -59,7 +59,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} An Object with the number of items matching the query. * @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#show-results-count} * @example * const { count } = await client.search.showResultsCount('open tickets'); diff --git a/src/clients/core/sessions.js b/src/clients/core/sessions.js index 8e0766c..ef00c53 100644 --- a/src/clients/core/sessions.js +++ b/src/clients/core/sessions.js @@ -38,7 +38,7 @@ class Sessions extends Client { * Retrieve a specific session by user ID and session ID. * @param {number} userId - The ID of the user. * @param {number} sessionId - The ID of the session. - * @returns {Promise} Session details. + * @returns {Promise<{response: object, result: object}>} Session details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#show-session} * @example * const session = await client.sessions.getByUserIdBySessionId(12345, 67890); @@ -49,7 +49,7 @@ class Sessions extends Client { /** * Retrieve details of the currently authenticated session. - * @returns {Promise} Session details. + * @returns {Promise<{response: object, result: object}>} Session details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/sessions/#show-the-currently-authenticated-session} * @example * const session = await client.sessions.getMyAuthenticatedSession(); diff --git a/src/clients/core/sharingagreement.js b/src/clients/core/sharingagreement.js index 02b48d7..eab7938 100644 --- a/src/clients/core/sharingagreement.js +++ b/src/clients/core/sharingagreement.js @@ -14,7 +14,7 @@ class SharingAgreement extends Client { /** * List all Sharing Agreements. - * @returns {Promise} An array of Sharing Agreement objects. + * @returns {Promise<{response: object, result: object[]}>} An array of Sharing Agreement objects. * @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 @@ -27,7 +27,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The Sharing Agreement object. * @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 @@ -40,7 +40,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The created Sharing Agreement object. * @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 @@ -57,7 +57,7 @@ class SharingAgreement extends Client { * Update an existing Sharing Agreement. * @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. + * @returns {Promise<{response: object, result: object}>} The updated Sharing Agreement object. * @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 diff --git a/src/clients/core/sideconversations.js b/src/clients/core/sideconversations.js index abf1317..6ad78f1 100644 --- a/src/clients/core/sideconversations.js +++ b/src/clients/core/sideconversations.js @@ -82,7 +82,7 @@ class SideConversations extends Client { * Create a Side Conversation. * @param {number} ticketId - The ID of the ticket. * @param {CreateSideConversation} message - The side conversation object. - * @returns {Promise<{result: SideConversationResponse}>} The created ticket details. + * @returns {Promise<{response: object, result: SideConversationResponse}>} The created ticket details. * @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 */ @@ -95,7 +95,7 @@ class SideConversations extends Client { * @param {number} ticketId - The ID of the ticket. * @param {string} sideConversationId - The ID of the side conversation. * @param {{message: Message}} message - The reply object. - * @returns {Promise<{result: SideConversationResponse}>} The created ticket details. + * @returns {Promise<{response: object, result: SideConversationResponse}>} The created ticket details. * @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 */ @@ -111,7 +111,7 @@ class SideConversations extends Client { * @param {number} ticketId - The ID of the ticket. * @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. + * @returns {Promise<{response: object, result: SideConversationResponse}>} The updated ticket details. * @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 */ @@ -138,7 +138,7 @@ class SideConversations extends Client { * Retrieve a specific ticket by its ID. * @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. + * @returns {Promise<{response: object, result: SideConversation}>} Details of the side conversation. * @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 e5794b2..243d6bf 100644 --- a/src/clients/core/suspendedtickets.js +++ b/src/clients/core/suspendedtickets.js @@ -24,7 +24,7 @@ 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 + * @returns {Promise<{response: object, result: object}>} Returns a promise that resolves to the details of the suspended ticket * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#show-suspended-ticket} * @example const ticket = await client.suspendedtickets.show(12345); */ @@ -35,7 +35,7 @@ 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 + * @returns {Promise<{response: object, result: object}>} Returns a promise that resolves once the ticket has been recovered * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#recover-suspended-ticket} * @example await client.suspendedtickets.recover(12345); */ @@ -46,7 +46,7 @@ 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 + * @returns {Promise<{response: object, result: object}>} Returns a promise that resolves once the tickets have been recovered * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#recover-multiple-suspended-tickets} * @example await client.suspendedtickets.recoverMany([12345, 67890]); */ @@ -103,7 +103,7 @@ 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 + * @returns {Promise<{response: object, result: object}>} Returns a promise that resolves to the attachments of the suspended ticket * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#suspended-ticket-attachments} * @example const attachments = await client.suspendedtickets.attachments(12345); */ @@ -113,7 +113,7 @@ 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 + * @returns {Promise<{response: object, result: object}>} Returns a promise that resolves once the export request has been initiated * @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 063ed5e..8165b35 100644 --- a/src/clients/core/tags.js +++ b/src/clients/core/tags.js @@ -27,7 +27,7 @@ class Tags extends Client { * @param {object} tagData - Data for the new tag. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves with the created tag. * @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 @@ -41,7 +41,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves with the retrieved tag. * @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 @@ -56,7 +56,7 @@ class Tags extends Client { * Updates a tag's information. * @param {number} id - Unique identifier of the tag. * @param {object} updatedData - Data to update. - * @returns {Promise} A promise that resolves with the updated tag. + * @returns {Promise<{response: object, result: object}>} A promise that resolves with the updated tag. * @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 diff --git a/src/clients/core/targetfailures.js b/src/clients/core/targetfailures.js index 503f8d1..4f1dc44 100644 --- a/src/clients/core/targetfailures.js +++ b/src/clients/core/targetfailures.js @@ -27,7 +27,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The target failure details. * @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 73d9c5e..07a758b 100644 --- a/src/clients/core/targets.js +++ b/src/clients/core/targets.js @@ -24,7 +24,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the target details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#show-target} * @example * const target = await client.targets.show(12345); @@ -36,7 +36,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the created target's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#create-target} * @example * const target = { @@ -55,7 +55,7 @@ class Targets extends Client { * Updates a specific target. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the updated target's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/targets/targets/#update-target} * @example * const updatedData = { email: 'updated@example.com' }; diff --git a/src/clients/core/ticketaudits.js b/src/clients/core/ticketaudits.js index c592201..afa0fa6 100644 --- a/src/clients/core/ticketaudits.js +++ b/src/clients/core/ticketaudits.js @@ -44,7 +44,7 @@ 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. + * @returns {Promise<{response: object, result: number}>} Returns an approximate count of audits. * @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 @@ -59,7 +59,7 @@ class TicketAudits extends Client { * Show details of a specific ticket audit. * @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. + * @returns {Promise<{response: object, result: object}>} Returns details of the ticket audit. * @throws {Error} Throws an error if request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_audits/#show-audit} * @example @@ -74,7 +74,7 @@ class TicketAudits extends Client { * Change a comment from public to private for a specific ticket audit. * @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. + * @returns {Promise<{response: object, result: object}>} Returns the updated ticket audit details. * @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 c66cf2c..bf9b1a3 100644 --- a/src/clients/core/ticketevents.js +++ b/src/clients/core/ticketevents.js @@ -47,7 +47,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns the result of the API call. * @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 4f69fc2..50f9dea 100644 --- a/src/clients/core/ticketexport.js +++ b/src/clients/core/ticketexport.js @@ -13,7 +13,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns the response from the Zendesk API. * @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); @@ -25,7 +25,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Returns the response from the Zendesk API with users and groups included. * @throws Will throw an error if the request fails. * @example const ticketsWithUsers = await client.ticketexport.exportWithUser(1332034771); */ @@ -63,7 +63,7 @@ class TicketExport extends Client { * Export tickets using the cursor-based approach. * @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. + * @returns {Promise<{response: object, result: object}>} Returns the response from the Zendesk API. * @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'); @@ -88,7 +88,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves with the exported sample of tickets. * @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 ea195db..96c8f01 100644 --- a/src/clients/core/ticketfields.js +++ b/src/clients/core/ticketfields.js @@ -75,7 +75,7 @@ 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. + * @returns {Promise<{response: object, result: TicketField}>} Returns the details of the ticket field. * @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 @@ -88,7 +88,7 @@ class TicketFields extends Client { /** * Retrieves the count of ticket fields. - * @returns {Promise} Returns the count of ticket fields. + * @returns {Promise<{response: object, result: object}>} Returns the count of ticket fields. * @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 @@ -102,7 +102,7 @@ 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. + * @returns {Promise<{response: object, result: TicketField}>} Returns the created ticket field. * @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 @@ -120,7 +120,7 @@ class TicketFields extends Client { * Updates a specific ticket field by ID. * @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. + * @returns {Promise<{response: object, result: TicketField}>} Returns the updated ticket field. * @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 @@ -150,7 +150,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} Returns an array of options for the ticket field. * @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 @@ -165,7 +165,7 @@ class TicketFields extends Client { * Retrieves a specific option of a ticket field by ID. * @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. + * @returns {Promise<{response: object, result: object}>} Returns the option details. * @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 @@ -180,7 +180,7 @@ class TicketFields extends Client { * Creates or updates an option of a ticket field. * @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. + * @returns {Promise<{response: object, result: object}>} Returns the created or updated option. * @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 diff --git a/src/clients/core/ticketforms.js b/src/clients/core/ticketforms.js index 56d04de..600f04f 100644 --- a/src/clients/core/ticketforms.js +++ b/src/clients/core/ticketforms.js @@ -33,7 +33,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The requested ticket form. * @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 @@ -47,7 +47,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the created ticket form. * @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 @@ -66,7 +66,7 @@ class TicketForms extends Client { * Update a specific ticket form by its ID. * @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. + * @returns {Promise<{response: object, result: object}>} The updated ticket form. * @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 @@ -94,7 +94,7 @@ class TicketForms extends Client { * Clones an already existing Ticket Form by its ID. * @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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the cloned ticket form details. * @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 @@ -110,7 +110,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} - A promise that resolves to the reordered ticket forms' details. * @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 3af51d2..3899ce4 100644 --- a/src/clients/core/ticketimport.js +++ b/src/clients/core/ticketimport.js @@ -22,7 +22,7 @@ class TicketImport extends Client { * @param {number} ticket.requester_id - The ID of the user requesting the ticket. * @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. + * @returns {Promise<{response: object, result: object}>} The response from the Zendesk API. * @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 @@ -65,7 +65,7 @@ class TicketImport extends Client { * - `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. + * @returns {Promise<{response: object, result: object}>} The response from the Zendesk API, including a job status object. * @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 19d90ee..ccdfd68 100644 --- a/src/clients/core/ticketmetrics.js +++ b/src/clients/core/ticketmetrics.js @@ -13,7 +13,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The ticket metrics data. * @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 @@ -40,7 +40,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The ticket metric data. * @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 341ec42..d1bd8de 100644 --- a/src/clients/core/tickets.js +++ b/src/clients/core/tickets.js @@ -263,7 +263,7 @@ 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. + * @returns {Promise<{response: object, result: Ticket}>} Metrics details for the ticket. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets} * @example * const metrics = await client.tickets.listMetrics(7890); @@ -275,7 +275,7 @@ 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. + * @returns {Promise<{response: object, result: Ticket}>} Details of the ticket. * @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 @@ -288,7 +288,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} An array of ticket details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-multiple-tickets} * @example * const ticketsDetails = await client.tickets.showMany([123, 456, 789]); @@ -300,7 +300,7 @@ 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. + * @returns {Promise<{response: object, result: Ticket}>} The created ticket details. * @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 @@ -313,7 +313,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} A promise that resolves to an array of created ticket objects. * @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 @@ -353,7 +353,7 @@ class Tickets extends Client { * Update multiple tickets by their IDs. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the updated ticket object. * @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 @@ -403,7 +403,7 @@ class Tickets extends Client { * Merge a ticket with another ticket. * @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. + * @returns {Promise<{response: object, result: Ticket}>} A promise that resolves with the merged ticket object. * @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 @@ -425,7 +425,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves with the exported tickets. * @throws {Error} If `startTime` is not a valid string. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#ticket-export} * @example @@ -443,7 +443,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves with the exported sample of tickets. * @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 @@ -503,7 +503,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} A promise that resolves with an array of exported incremental tickets. * @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 diff --git a/src/clients/core/triggers.js b/src/clients/core/triggers.js index bd168de..65f4257 100644 --- a/src/clients/core/triggers.js +++ b/src/clients/core/triggers.js @@ -14,7 +14,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The search results. * @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'); @@ -66,7 +66,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Details of the specified trigger. * @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); @@ -78,7 +78,7 @@ class Triggers extends Client { /** * Creates a new trigger. * @param {object} trigger - The trigger object to be created. - * @returns {Promise} The created trigger. + * @returns {Promise<{response: object, result: object}>} The created trigger. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#create-trigger} * @example @@ -97,7 +97,7 @@ class Triggers extends Client { * Updates an existing trigger. * @param {number} triggerID - The ID of the trigger to be updated. * @param {object} trigger - The updated trigger object. - * @returns {Promise} The updated trigger. + * @returns {Promise<{response: object, result: object}>} The updated trigger. * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/triggers/#update-trigger} * @example @@ -115,7 +115,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The response from the update request. * @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 @@ -189,7 +189,7 @@ class Triggers extends Client { * Fetches a specific revision associated with a trigger. * @param {number} triggerID - The ID of the trigger. * @param {number} revisionID - The ID of the revision. - * @returns {Promise} Details of the specified trigger revision. + * @returns {Promise<{response: object, result: object}>} Details of the specified trigger revision. * @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 d5db0db..0a8ba20 100644 --- a/src/clients/core/userfields.js +++ b/src/clients/core/userfields.js @@ -23,7 +23,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} Details of the user field. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#show-user-field} * @example const userField = await client.userfields.show(12345); */ @@ -34,7 +34,7 @@ class UserFields extends Client { /** * Creates a new user field. * @param {object} userField - The user field data. - * @returns {Promise} The created user field. + * @returns {Promise<{response: object, result: object}>} The created user field. * @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' }); */ @@ -46,7 +46,7 @@ class UserFields extends Client { * Updates an existing user field. * @param {number} userFieldID - The ID of the user field. * @param {object} userField - The updated user field data. - * @returns {Promise} The updated user field. + * @returns {Promise<{response: object, result: object}>} The updated user field. * @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' }); */ @@ -68,7 +68,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The reordered user fields. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#reorder-user-field} * @example await client.userfields.reorder([3, 4]); */ @@ -79,7 +79,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} The list of user field options. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user_fields/#list-user-field-options} * @example const options = await client.userfields.listOptions(12345); */ @@ -91,7 +91,7 @@ class UserFields extends Client { * Retrieves details of a specific user field option. * @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. + * @returns {Promise<{response: object, result: object}>} Details of the user field option. * @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); */ @@ -103,7 +103,7 @@ class UserFields extends Client { * Creates or updates a user field option. * @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. + * @returns {Promise<{response: object, result: object}>} The created or updated user field option. * @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' }); */ diff --git a/src/clients/core/useridentities.js b/src/clients/core/useridentities.js index 8bf6c15..2d765c0 100644 --- a/src/clients/core/useridentities.js +++ b/src/clients/core/useridentities.js @@ -26,7 +26,7 @@ class UserIdentities extends Client { * Show a specific identity for a given user. * @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. + * @returns {Promise<{response: object, result: object}>} The user identity details. * @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); @@ -39,7 +39,7 @@ class UserIdentities extends Client { * Create a new identity for a given user. * @param {number} userId - The ID of the user. * @param {object} userIdentity - The user identity details to create. - * @returns {Promise} The created user identity. + * @returns {Promise<{response: object, result: object}>} The created user identity. * @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'}); @@ -62,7 +62,7 @@ class UserIdentities extends Client { * @param {number} userId - The ID of the user. * @param {number} userIdentityId - The ID of the user identity to update. * @param {object} identity - The updated identity details. - * @returns {Promise} The updated user identity. + * @returns {Promise<{response: object, result: object}>} The updated user identity. * @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}); @@ -75,7 +75,7 @@ class UserIdentities extends Client { * Make a specific identity the primary identity for a given user. * @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. + * @returns {Promise<{response: object, result: object}>} The updated user identity. * @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); @@ -94,7 +94,7 @@ class UserIdentities extends Client { * Verify a specific identity for a given user. * @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. + * @returns {Promise<{response: object, result: object}>} The verified user identity. * @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); @@ -107,7 +107,7 @@ class UserIdentities extends Client { * Request verification for a specific identity for a given user. * @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. + * @returns {Promise<{response: object, result: object}>} The user identity verification request details. * @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); diff --git a/src/clients/core/users.js b/src/clients/core/users.js index 6b705c1..2adfdef 100644 --- a/src/clients/core/users.js +++ b/src/clients/core/users.js @@ -73,7 +73,7 @@ class Users extends Client { /** * Authenticates the current user. - * @returns {Promise} The authenticated user's details. + * @returns {Promise<{response: object, result: User}>} The authenticated user's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-the-currently-authenticated-user} * @example * const user = await client.users.auth(); @@ -133,7 +133,7 @@ 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. + * @returns {Promise<{response: object, result: User}>} The user's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user} * @example * const user = await client.users.show(12345); @@ -145,7 +145,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} An array of user details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-many-users} * @example * const users = await client.users.showMany([12345, 67890]); @@ -157,7 +157,7 @@ class Users extends Client { /** * Creates a new user. * @param {object} user - The user details. - * @returns {Promise} The created user's details. + * @returns {Promise<{response: object, result: User}>} The created user's details. * @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'}); @@ -169,7 +169,7 @@ class Users extends Client { /** * Creates multiple users. * @param {Array} users - An array of user details. - * @returns {Promise>} An array of created user details. + * @returns {Promise<{response: object, result: Array}>} An array of created user details. * @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'}]); @@ -181,7 +181,7 @@ class Users extends Client { /** * Creates or updates a user. * @param {object} user - The user details. - * @returns {Promise} The created or updated user's details. + * @returns {Promise<{response: object, result: User}>} The created or updated user's details. * @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'}); @@ -193,7 +193,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} An array of created or updated user details. * @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'}]); @@ -206,7 +206,7 @@ class Users extends Client { * Updates a user by ID. * @param {number} id - The ID of the user. * @param {object} user - The updated user details. - * @returns {Promise} The updated user's details. + * @returns {Promise<{response: object, result: User}>} The updated user's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#update-user} * @example * const updatedUser = await client.users.update(12345, {name: 'Johnathan Doe'}); @@ -218,7 +218,7 @@ class Users extends Client { /** * Updates multiple users. * @param {...*} arguments_ - Arguments including optional IDs and user details. - * @returns {Promise>} An array of updated user details. + * @returns {Promise<{response: object, result: Array}>} An array of updated user details. * @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 @@ -278,7 +278,7 @@ 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. + * @returns {Promise<{response: object, result: User}>} The suspended user's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#suspend-user} * @example * await client.users.suspend(12345); @@ -290,7 +290,7 @@ 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. + * @returns {Promise<{response: object, result: User}>} The unsuspended user's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#unsuspend-user} * @example * await client.users.unsuspend(12345); @@ -386,7 +386,7 @@ class Users extends Client { /** * Retrieves details of the currently authenticated user. - * @returns {Promise<{result: User}>} The user's details.The authenticated user's details. + * @returns {Promise<{response: object, result: User}>} The authenticated user's details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#show-the-currently-authenticated-user} * @example * const user = await client.users.me(); @@ -399,7 +399,7 @@ class Users extends Client { * Merges a user into another user. * @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. + * @returns {Promise<{response: object, result: object}>} The details of the merged user. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#merge-user-into-another-user} * @example * await client.users.merge(12345, 67890); @@ -413,7 +413,7 @@ class Users extends Client { * @param {number} userId - The ID of the user whose password is to be changed. * @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. + * @returns {Promise<{response: object, result: object}>} The user's details after the password change. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#change-password} * @example * await client.users.password(12345, 'oldPassword123', 'newPassword456'); @@ -457,7 +457,7 @@ 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. + * @returns {Promise<{response: object, result: Array}>} A sample array of user objects. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/users/#incremental-sample-export-users} * @example * const usersSample = await client.users.incrementalSample(1632614395); @@ -487,7 +487,7 @@ class Users extends Client { * Sets tags for a user. * @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. + * @returns {Promise<{response: object, result: object}>} The user's details with the updated tags. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user-tags/#set-tags} * @example * await client.users.setTags(12345, ['tag1', 'tag2']); @@ -500,7 +500,7 @@ class Users extends Client { * Adds tags to a user. * @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. + * @returns {Promise<{response: object, result: object}>} The user's details with the added tags. * @see {@link https://developer.zendesk.com/api-reference/ticketing/users/user-tags/#add-tags} * @example * await client.users.addTags(12345, ['tag3', 'tag4']); diff --git a/src/clients/core/views.js b/src/clients/core/views.js index f8aee06..4c6eda7 100644 --- a/src/clients/core/views.js +++ b/src/clients/core/views.js @@ -47,7 +47,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the details of the view. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view} * @example * const viewDetails = await client.views.show(12345); @@ -59,7 +59,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the created view details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#create-view} * @example * const newView = { @@ -76,7 +76,7 @@ class Views extends Client { * Updates an existing view by its ID. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the updated view details. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#update-view} * @example * const updatedData = { @@ -130,7 +130,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the ticket count for the view. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view-count} * @example const ticketCount = await client.views.showCount(12345); */ @@ -141,7 +141,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the ticket counts for the specified views. * @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]); */ @@ -152,7 +152,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the exported views in JSON format. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#export-view} * @example const exportedViews = await client.views.export([12345, 67890]); */ @@ -162,7 +162,7 @@ class Views extends Client { /** * Retrieves all active shared views. - * @returns {Promise} A promise that resolves to the list of all active shared views. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the list of all active shared views. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-active-shared-views} */ async listActiveShared() { @@ -172,7 +172,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the execution status of the view. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view-execution-status} */ async showExecutionStatus(viewID) { @@ -182,7 +182,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the recent ticket IDs of the view. * @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view-recent-ticket-ids} */ async showRecentTicketIDs(viewID) { @@ -202,7 +202,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves when the views are reordered. * @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 0a133f5..f6f78c8 100644 --- a/src/clients/core/webhooks.js +++ b/src/clients/core/webhooks.js @@ -25,7 +25,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the specified webhook. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#show-webhook} * @example const webhook = await client.webhooks.show('webhookID123'); */ @@ -36,7 +36,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the created webhook. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#create-or-clone-webhook} * @example * const newWebhook = { @@ -52,7 +52,7 @@ class Webhooks extends Client { * Update a specific webhook by ID. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the updated webhook. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#update-webhook} * @example * const updatedData = { @@ -81,7 +81,7 @@ class Webhooks extends Client { * Test a new or existing webhook. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the test result. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#test-webhook} * @example * const requestData = { @@ -99,7 +99,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the list of invocations. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhook-invocations} * @example const invocations = await client.webhooks.listInvocations('webhookID123'); */ @@ -111,7 +111,7 @@ class Webhooks extends Client { * List invocation attempts for a specific webhook. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the list of invocation attempts. * @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'); */ @@ -128,7 +128,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the signing secret. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#show-webhook-signing-secret} * @example const secret = await client.webhooks.getSigningSecret('webhookID123'); */ @@ -139,7 +139,7 @@ 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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the new signing secret. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#reset-webhook-signing-secret} * @example const newSecret = await client.webhooks.resetSigningSecret('webhookID123'); */ @@ -151,7 +151,7 @@ class Webhooks extends Client { * Patch a specific webhook by ID. * @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. + * @returns {Promise<{response: object, result: object}>} A promise that resolves to the patched webhook. * @see {@link https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#patch-webhook} * @example * const patchData = {