Skip to content

Commit 979fed6

Browse files
authored
Merge pull request #419 from m-rolana/missing-locale-support-for-ticket_fields-list
add listWithLocale for ticket_fields entity
2 parents 6dfa21b + d1b77a3 commit 979fed6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/clients/core/ticketfields.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class TicketFields extends Client {
4747

4848
/**
4949
* Lists all ticket fields.
50-
* @returns {Promise<Array<TicketField>>}>} Returns an array of ticket fields.
50+
* @returns {Promise<Array<TicketField>>}} Returns an array of ticket fields.
5151
* @async
5252
* @throws {Error} Throws an error if the request fails.
5353
* @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields}
@@ -59,6 +59,20 @@ class TicketFields extends Client {
5959
return this.getAll(['ticket_fields']);
6060
}
6161

62+
/**
63+
* Lists all ticket fields with locale.
64+
* @returns {Promise<Array<TicketField>>}} Returns an array of ticket fields by locale.
65+
* @async
66+
* @throws {Error} Throws an error if the request fails.
67+
* @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields}
68+
* @example
69+
* const client = createClient({...});
70+
* const fields = await client.ticketfields.listWithLocale('sv');
71+
*/
72+
async listWithLocale(locale) {
73+
return this.getAll(['ticket_fields', { locale }]);
74+
}
75+
6276
/**
6377
* Retrieves a specific ticket field by ID.
6478
* @param {number} ticketFieldId - The ID of the ticket field to retrieve.

0 commit comments

Comments
 (0)