From d1b77a372dd27c775f76ea99972c7fefa8bd9357 Mon Sep 17 00:00:00 2001 From: Maria Mikhalska Date: Mon, 8 Jul 2024 11:00:03 +0300 Subject: [PATCH] add listWithLocale for ticket_fields entity --- src/clients/core/ticketfields.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/clients/core/ticketfields.js b/src/clients/core/ticketfields.js index ab9a3fed..bf04fd61 100644 --- a/src/clients/core/ticketfields.js +++ b/src/clients/core/ticketfields.js @@ -47,7 +47,7 @@ class TicketFields extends Client { /** * Lists all ticket fields. - * @returns {Promise>}>} Returns an array of ticket fields. + * @returns {Promise>}} Returns an array of ticket fields. * @async * @throws {Error} Throws an error if the request fails. * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields} @@ -59,6 +59,20 @@ class TicketFields extends Client { return this.getAll(['ticket_fields']); } + /** + * Lists all ticket fields with locale. + * @returns {Promise>}} Returns an array of ticket fields by locale. + * @async + * @throws {Error} Throws an error if the request fails. + * @see {@link https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields} + * @example + * const client = createClient({...}); + * const fields = await client.ticketfields.listWithLocale('sv'); + */ + async listWithLocale(locale) { + return this.getAll(['ticket_fields', { locale }]); + } + /** * Retrieves a specific ticket field by ID. * @param {number} ticketFieldId - The ID of the ticket field to retrieve.