Skip to content

Commit

Permalink
Improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
dugjason committed Oct 13, 2024
1 parent ca381ad commit f10d0d6
Show file tree
Hide file tree
Showing 46 changed files with 219 additions and 219 deletions.
4 changes: 2 additions & 2 deletions src/clients/core/accountsettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AccountSettings extends Client {

/**
* Retrieves the account settings.
* @returns {Promise<object>} 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();
Expand All @@ -26,7 +26,7 @@ class AccountSettings extends Client {
/**
* Updates the account settings.
* @param {object} settings - The settings to update.
* @returns {Promise<object>} 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 }}});
Expand Down
4 changes: 2 additions & 2 deletions src/clients/core/activitystream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<object>} 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.
Expand All @@ -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<object>} 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();
Expand Down
4 changes: 2 additions & 2 deletions src/clients/core/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Attachments extends Client {
/**
* Retrieve details of a specific attachment.
* @param {number} attachmentID - The ID of the attachment.
* @returns {Promise<object>} 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);
Expand Down Expand Up @@ -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<object>} 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
Expand Down
8 changes: 4 additions & 4 deletions src/clients/core/automations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<object>} 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);
*/
Expand All @@ -49,7 +49,7 @@ class Automations extends Client {
/**
* Create a new automation.
* @param {object} automationData - Data for the new automation.
* @returns {Promise<object>} 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({
Expand All @@ -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<object>} 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, {
Expand All @@ -80,7 +80,7 @@ class Automations extends Client {
/**
* Update many automations in bulk.
* @param {Array<object>} automations - Array of automation data with their IDs to be updated.
* @returns {Promise<object>} 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}]);
Expand Down
12 changes: 6 additions & 6 deletions src/clients/core/brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Brand extends Client {

/**
* List all brands.
* @returns {Promise<object>} The list of brands.
* @returns {Promise<{response: object, result: Array<object>}>} 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();
*/
Expand All @@ -23,7 +23,7 @@ class Brand extends Client {
/**
* Show a specific brand by ID.
* @param {number} brandId - The ID of the brand.
* @returns {Promise<object>} 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);
*/
Expand All @@ -34,7 +34,7 @@ class Brand extends Client {
/**
* Create a new brand.
* @param {object} brand - The brand data.
* @returns {Promise<object>} 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"});
*/
Expand All @@ -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<object>} 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);
*/
Expand All @@ -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<object>} 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");
*/
Expand All @@ -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<object>} 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);
*/
Expand Down
6 changes: 3 additions & 3 deletions src/clients/core/customagentroles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<object>} 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
Expand All @@ -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<object>} 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
Expand All @@ -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<object>} 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
Expand Down
10 changes: 5 additions & 5 deletions src/clients/core/dynamiccontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DynamicContent extends Client {

/**
* Lists the dynamic content items.
* @returns {Promise<object>} The dynamic content items.
* @returns {Promise<{response: object, result: Array<object>}>} 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();
Expand All @@ -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<object>} 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);
Expand All @@ -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<object>} Returns the fetched dynamic content items.
* @returns {Promise<{response: object, result: Array<object>}>} 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
Expand All @@ -68,7 +68,7 @@ class DynamicContent extends Client {
/**
* Creates a new dynamic content item.
* @param {object} item - The item to create.
* @returns {Promise<object>} 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: [...]});
Expand All @@ -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<object>} 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"});
Expand Down
12 changes: 6 additions & 6 deletions src/clients/core/dynamiccontentvariants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<object>} The variants of the specified content item.
* @returns {Promise<{response: object, result: Array<object>}>} 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
Expand All @@ -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<object>} 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
Expand All @@ -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<object>} 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
Expand All @@ -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<object>} 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
Expand Down Expand Up @@ -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<object>} 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
Expand All @@ -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<object>} 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
Expand Down
Loading

0 comments on commit f10d0d6

Please sign in to comment.