Skip to content

Commit c4b6107

Browse files
authored
Merge pull request #429 from dugjason/fix-types
Improve TS Types
2 parents fa069d9 + f10d0d6 commit c4b6107

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+222
-222
lines changed

src/clients/core/accountsettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AccountSettings extends Client {
1414

1515
/**
1616
* Retrieves the account settings.
17-
* @returns {Promise<object>} A promise that resolves to the account settings.
17+
* @returns {Promise<{response: object, result: object}>} A promise that resolves to the account settings.
1818
* {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/account_settings/#show-settings | See the Zendesk API documentation for more details}.
1919
* @example
2020
* const settings = await client.accountsettings.show();
@@ -26,7 +26,7 @@ class AccountSettings extends Client {
2626
/**
2727
* Updates the account settings.
2828
* @param {object} settings - The settings to update.
29-
* @returns {Promise<object>} A promise that resolves to the updated account settings.
29+
* @returns {Promise<{response: object, result: object}>} A promise that resolves to the updated account settings.
3030
* {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/account_settings/#update-account-settings | See the Zendesk API documentation for more details}.
3131
* @example
3232
* const settings = await client.accountsettings.update({ "settings": { "active_features": { "customer_satisfaction": false }}});

src/clients/core/activitystream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ActivityStream extends Client {
3434
/**
3535
* Retrieves a specific ticket activity by its ID.
3636
* @param {number} activityID - The unique ID of the activity to fetch.
37-
* @returns {Promise<object>} A promise that resolves to the activity object corresponding to the provided activityID.
37+
* @returns {Promise<{response: object, result: object}>} A promise that resolves to the activity object corresponding to the provided activityID.
3838
* @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/activity_stream/#show-activity | Zendesk API - Show Activity}
3939
* @example
4040
* const activity = await client.activitystream.show(12345); // Where 12345 is an activity ID.
@@ -50,7 +50,7 @@ class ActivityStream extends Client {
5050
* The count[refreshed_at] property is a timestamp that indicates when the count was last updated.
5151
* Note: When the count exceeds 100,000, count[refreshed_at] may occasionally be null. This indicates
5252
* that the count is being updated in the background, and count[value] is limited to 100,000 until the update is complete.
53-
* @returns {Promise<object>} A promise that resolves to an object containing the activity count and the refreshed_at timestamp.
53+
* @returns {Promise<{response: object, result: object}>} A promise that resolves to an object containing the activity count and the refreshed_at timestamp.
5454
* @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/activity_stream/#count-activities | Zendesk API - Count Activities}
5555
* @example
5656
* const activityCount = await client.activitystream.count();

src/clients/core/attachments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Attachments extends Client {
5858
/**
5959
* Retrieve details of a specific attachment.
6060
* @param {number} attachmentID - The ID of the attachment.
61-
* @returns {Promise<object>} Returns the details of the attachment.
61+
* @returns {Promise<{response: object, result: object}>} Returns the details of the attachment.
6262
* @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#show-attachment}
6363
* @example
6464
* const attachmentDetails = await client.attachments.show(12345);
@@ -96,7 +96,7 @@ class Attachments extends Client {
9696
* Toggles enabling or restricting agent access to attachments with detected malware.
9797
* @param {number} attachmentID - The ID of the attachment.
9898
* @param {boolean} malwareAccessOverride - Whether to override malware access. If true, agent can access attachment flagged as malware.
99-
* @returns {Promise<object>} The response from the Zendesk API.
99+
* @returns {Promise<{response: object, result: object}>} The response from the Zendesk API.
100100
* @throws {Error} Throws an error if the request fails.
101101
* @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/#update-attachment-for-malware}
102102
* @example

src/clients/core/automations.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Automations extends Client {
3838
/**
3939
* Get details of a specific automation by ID.
4040
* @param {number} automationID - The ID of the automation.
41-
* @returns {Promise<object>} Returns details of the automation.
41+
* @returns {Promise<{response: object, result: object}>} Returns details of the automation.
4242
* @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#show-automation}
4343
* @example const automationDetails = await client.automations.show(123456);
4444
*/
@@ -49,7 +49,7 @@ class Automations extends Client {
4949
/**
5050
* Create a new automation.
5151
* @param {object} automationData - Data for the new automation.
52-
* @returns {Promise<object>} Returns the created automation.
52+
* @returns {Promise<{response: object, result: object}>} Returns the created automation.
5353
* @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#create-automation}
5454
* @example
5555
* const automation = await client.automations.create({
@@ -66,7 +66,7 @@ class Automations extends Client {
6666
* Update an existing automation.
6767
* @param {number} automationID - ID of the automation to update.
6868
* @param {object} updatedData - Updated data for the automation.
69-
* @returns {Promise<object>} Returns the updated automation.
69+
* @returns {Promise<{response: object, result: object}>} Returns the updated automation.
7070
* @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#update-automation}
7171
* @example
7272
* const updatedAutomation = await client.automations.update(12345, {
@@ -80,7 +80,7 @@ class Automations extends Client {
8080
/**
8181
* Update many automations in bulk.
8282
* @param {Array<object>} automations - Array of automation data with their IDs to be updated.
83-
* @returns {Promise<object>} Returns the status of the bulk update.
83+
* @returns {Promise<{response: object, result: object}>} Returns the status of the bulk update.
8484
* @see {@link https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#update-many-automation}
8585
* @example
8686
* const status = await client.automations.updateMany([{id: 123, position: 1}, {id: 124, position: 2}]);

src/clients/core/brand.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Brand extends Client {
1212

1313
/**
1414
* List all brands.
15-
* @returns {Promise<object>} The list of brands.
15+
* @returns {Promise<{response: object, result: Array<object>}>} The list of brands.
1616
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#list-brands}
1717
* @example const brands = await client.brands.list();
1818
*/
@@ -23,7 +23,7 @@ class Brand extends Client {
2323
/**
2424
* Show a specific brand by ID.
2525
* @param {number} brandId - The ID of the brand.
26-
* @returns {Promise<object>} The brand details.
26+
* @returns {Promise<{response: object, result: object}>} The brand details.
2727
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#show-a-brand}
2828
* @example const brand = await client.brands.show(47);
2929
*/
@@ -34,7 +34,7 @@ class Brand extends Client {
3434
/**
3535
* Create a new brand.
3636
* @param {object} brand - The brand data.
37-
* @returns {Promise<object>} The created brand details.
37+
* @returns {Promise<{response: object, result: object}>} The created brand details.
3838
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#create-brand}
3939
* @example const newBrand = await client.brands.create({name: "Brand 1", subdomain: "Brand1"});
4040
*/
@@ -46,7 +46,7 @@ class Brand extends Client {
4646
* Update an existing brand.
4747
* @param {object} brand - The updated brand data.
4848
* @param {number} brandId - The ID of the brand to update.
49-
* @returns {Promise<object>} The updated brand details.
49+
* @returns {Promise<{response: object, result: object}>} The updated brand details.
5050
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#update-a-brand}
5151
* @example const updatedBrand = await client.brands.update({name: "Updated Brand"}, 47);
5252
*/
@@ -69,7 +69,7 @@ class Brand extends Client {
6969
* Check host mapping validity for a given subdomain and host mapping.
7070
* @param {string} hostMapping - The host mapping to check.
7171
* @param {string} subdomain - The subdomain to check.
72-
* @returns {Promise<object>} The check result.
72+
* @returns {Promise<{response: object, result: object}>} The check result.
7373
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#check-host-mapping-validity}
7474
* @example await client.brands.checkHostMapping("brand1.com", "brand1");
7575
*/
@@ -84,7 +84,7 @@ class Brand extends Client {
8484
/**
8585
* Check host mapping validity for an existing brand.
8686
* @param {number} brandId - The ID of the brand to check.
87-
* @returns {Promise<object>} The check result.
87+
* @returns {Promise<{response: object, result: object}>} The check result.
8888
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/brands/#check-host-mapping-validity-for-an-existing-brand}
8989
* @example await client.brands.checkHostMappingForExistingBrand(47);
9090
*/

src/clients/core/customagentroles.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CustomAgentRoles extends Client {
2626
/**
2727
* Retrieve a specific Custom Agent Role by its ID.
2828
* @param {number} roleId The ID of the custom agent role to retrieve.
29-
* @returns {Promise<object>} Returns a promise that resolves with the specified custom agent role.
29+
* @returns {Promise<{response: object, result: object}>} Returns a promise that resolves with the specified custom agent role.
3030
* @throws Will throw an error if unable to retrieve the role.
3131
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#show-custom-role}
3232
* @example
@@ -40,7 +40,7 @@ class CustomAgentRoles extends Client {
4040
/**
4141
* Creates a new custom agent role.
4242
* @param {object} roleData - The data for the new custom agent role.
43-
* @returns {Promise<object>} The created custom agent role.
43+
* @returns {Promise<{response: object, result: object}>} The created custom agent role.
4444
* @throws Will throw an error if creation fails.
4545
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#create-custom-role}
4646
* @example
@@ -59,7 +59,7 @@ class CustomAgentRoles extends Client {
5959
* Updates an existing custom agent role.
6060
* @param {number} customRoleId - The ID of the custom agent role to update.
6161
* @param {object} updatedData - The updated data for the custom agent role.
62-
* @returns {Promise<object>} The updated custom agent role.
62+
* @returns {Promise<{response: object, result: object}>} The updated custom agent role.
6363
* @throws Will throw an error if the update fails or custom agent role ID is not found.
6464
* @see {@link https://developer.zendesk.com/api-reference/ticketing/account-configuration/custom_roles/#update-custom-role}
6565
* @example

src/clients/core/dynamiccontent.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DynamicContent extends Client {
1717

1818
/**
1919
* Lists the dynamic content items.
20-
* @returns {Promise<object>} The dynamic content items.
20+
* @returns {Promise<{response: object, result: Array<object>}>} The dynamic content items.
2121
* @throws {Error} Throws an error if the request fails.
2222
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#list-items}
2323
* @example const items = await client.dynamiccontent.listItems();
@@ -39,7 +39,7 @@ class DynamicContent extends Client {
3939
/**
4040
* Shows a specific dynamic content item.
4141
* @param {number} itemID - The ID of the dynamic content item.
42-
* @returns {Promise<object>} The specified dynamic content item.
42+
* @returns {Promise<{response: object, result: object}>} The specified dynamic content item.
4343
* @throws {Error} Throws an error if the request fails.
4444
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#show-item}
4545
* @example const item = await client.dynamiccontent.showItem(12345);
@@ -51,7 +51,7 @@ class DynamicContent extends Client {
5151
/**
5252
* Retrieves multiple dynamic content items using their identifiers.
5353
* @param {string[]} identifiers - An array of identifiers for the dynamic content items.
54-
* @returns {Promise<object>} Returns the fetched dynamic content items.
54+
* @returns {Promise<{response: object, result: Array<object>}>} Returns the fetched dynamic content items.
5555
* @throws {Error} Throws an error if the provided identifiers parameter is not a valid array or is empty.
5656
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#show-many-items}
5757
* @example
@@ -68,7 +68,7 @@ class DynamicContent extends Client {
6868
/**
6969
* Creates a new dynamic content item.
7070
* @param {object} item - The item to create.
71-
* @returns {Promise<object>} The created dynamic content item.
71+
* @returns {Promise<{response: object, result: object}>} The created dynamic content item.
7272
* @throws {Error} Throws an error if the request fails.
7373
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#create-item}
7474
* @example const newItem = await client.dynamiccontent.createItem({name: "Sample Item", default_locale_id: 1, variants: [...]});
@@ -81,7 +81,7 @@ class DynamicContent extends Client {
8181
* Updates a specific dynamic content item.
8282
* @param {number} itemID - The ID of the dynamic content item.
8383
* @param {object} item - The updated item details.
84-
* @returns {Promise<object>} The updated dynamic content item.
84+
* @returns {Promise<{response: object, result: object}>} The updated dynamic content item.
8585
* @throws {Error} Throws an error if the request fails.
8686
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/#update-item}
8787
* @example const updatedItem = await client.dynamiccontent.updateItem(12345, {name: "Updated Name"});

src/clients/core/dynamiccontentvariants.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DynamicContentVariants extends Client {
1616
/**
1717
* Lists all variants of a specified dynamic content item.
1818
* @param {number} itemID - The ID of the dynamic content item.
19-
* @returns {Promise<object>} The variants of the specified content item.
19+
* @returns {Promise<{response: object, result: Array<object>}>} The variants of the specified content item.
2020
* @throws {Error} Throws an error if request fails.
2121
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#list-variants}
2222
* @example
@@ -30,7 +30,7 @@ class DynamicContentVariants extends Client {
3030
* Fetches the details of a specified dynamic content variant.
3131
* @param {number} itemID - The ID of the dynamic content item.
3232
* @param {number} variantID - The ID of the variant to fetch.
33-
* @returns {Promise<object>} Returns the dynamic content variant details.
33+
* @returns {Promise<{response: object, result: object}>} Returns the dynamic content variant details.
3434
* @throws {Error} Throws an error if the API call fails.
3535
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#show-variant}
3636
* @example
@@ -51,7 +51,7 @@ class DynamicContentVariants extends Client {
5151
* Creates a new dynamic content variant.
5252
* @param {number} itemID - The ID of the dynamic content item.
5353
* @param {object} variant - The details of the variant to create.
54-
* @returns {Promise<object>} Returns the details of the created variant.
54+
* @returns {Promise<{response: object, result: object}>} Returns the details of the created variant.
5555
* @throws {Error} Throws an error if the API call fails or if a locale variant already exists.
5656
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#create-variant}
5757
* @example
@@ -73,7 +73,7 @@ class DynamicContentVariants extends Client {
7373
* @param {number} itemID - The ID of the dynamic content item.
7474
* @param {number} variantID - The ID of the variant to update.
7575
* @param {object} variant - The updated details of the variant.
76-
* @returns {Promise<object>} Returns the details of the updated variant.
76+
* @returns {Promise<{response: object, result: object}>} Returns the details of the updated variant.
7777
* @throws {Error} Throws an error if the API call fails or if you try to switch the active state of the default variant.
7878
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#update-variant}
7979
* @example
@@ -116,7 +116,7 @@ class DynamicContentVariants extends Client {
116116
* Creates multiple variants for a dynamic content item.
117117
* @param {number} itemID - The ID of the dynamic content item.
118118
* @param {object[]} variants - Array of variant objects to be created.
119-
* @returns {Promise<object>} A confirmation of the creation.
119+
* @returns {Promise<{response: object, result: object}>} A confirmation of the creation.
120120
* @throws {Error} Throws an error if request fails.
121121
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#create-many-variants}
122122
* @example
@@ -133,7 +133,7 @@ class DynamicContentVariants extends Client {
133133
* Updates multiple variants of a dynamic content item.
134134
* @param {number} itemID - The ID of the dynamic content item.
135135
* @param {object[]} variants - Array of variant objects to be updated.
136-
* @returns {Promise<object>} A confirmation of the update.
136+
* @returns {Promise<{response: object, result: object}>} A confirmation of the update.
137137
* @throws {Error} Throws an error if request fails.
138138
* @see {@link https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants/#update-many-variants}
139139
* @example

0 commit comments

Comments
 (0)