node-zendesk • Docs
node-zendesk / clients/core/ticketfields / TicketFields
Class: TicketFields
Client for the Zendesk Ticket Fields API.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/
Extends
Constructors
new TicketFields()
new TicketFields(
options
):TicketFields
Parameters
• options: any
Returns
Overrides
Defined in
clients/core/ticketfields.d.ts:161
Properties
_transporter
_transporter:
Transporter
Inherited from
Defined in
clients/client.d.ts:42
eventTarget
eventTarget:
CustomEventTarget
Event target to handle custom events.
Inherited from
Defined in
clients/client.d.ts:40
jsonAPINames
jsonAPINames:
string
[]
Array to hold names used in the JSON API.
Overrides
Defined in
clients/core/ticketfields.d.ts:162
options
options:
ZendeskClientOptions
&object
Configuration options for the client.
Type declaration
get()
get: (
key
) =>any
Parameters
• key: string
Returns
any
Inherited from
Defined in
clients/client.d.ts:34
sideLoad
sideLoad:
any
[]
Array to handle side-loaded resources.
Inherited from
Defined in
clients/client.d.ts:37
useDotJson
useDotJson:
boolean
Flag to indicate if the API endpoint should use '.json' ending.
Inherited from
Defined in
clients/client.d.ts:39
Accessors
transporter
Get Signature
get transporter():
Transporter
Returns
Transporter for making requests.
Inherited from
Defined in
clients/client.d.ts:41
Methods
_rawRequest()
_rawRequest(
method
,uri
, ...arguments_
):Promise
<object
>
Parameters
• method: any
• uri: any
• ...arguments_: any
[]
Returns
Promise
<object
>
response
response:
any
result
result:
object
Inherited from
Defined in
clients/client.d.ts:78
count()
count():
Promise
<object
>
Retrieves the count of ticket fields.
Returns
Promise
<object
>
Returns the count of ticket fields.
response
response:
object
result
result:
object
Throws
Throws an error if the request fails.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#count-ticket-fields
Example
const client = createClient({...});
const count = await client.ticketfields.count();
Defined in
clients/core/ticketfields.d.ts:207
create()
create(
ticketField
):Promise
<object
>
Creates a new ticket field.
Parameters
• ticketField: object
The properties of the ticket field to create.
Returns
Promise
<object
>
Returns the created ticket field.
response
response:
object
result
result:
TicketField
Throws
Throws an error if the request fails.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#create-ticket-field
Example
const client = createClient({...});
const newField = await client.ticketfields.create({
type: 'text',
title: 'New Field'
});
Defined in
clients/core/ticketfields.d.ts:224
createOrUpdateOption()
createOrUpdateOption(
ticketFieldId
,option
):Promise
<object
>
Creates or updates an option of a ticket field.
Parameters
• ticketFieldId: number
The ID of the ticket field.
• option: object
The properties of the option to create or update.
Returns
Promise
<object
>
Returns the created or updated option.
response
response:
object
result
result:
object
Throws
Throws an error if the request fails.
See
Example
const client = createClient({...});
const newOption = await client.ticketfields.createOrUpdateOption(12345, {
custom_field_option: {
name: 'Option Name',
value: 'Option Value'
}
});
Defined in
clients/core/ticketfields.d.ts:301
delete()
delete(
ticketFieldId
):Promise
<void
>
Deletes a specific ticket field by ID.
Parameters
• ticketFieldId: number
The ID of the ticket field to delete.
Returns
Promise
<void
>
Throws
Throws an error if the request fails.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#delete-ticket-field
Example
const client = createClient({...});
await client.ticketfields.delete(12345);
Overrides
Defined in
clients/core/ticketfields.d.ts:255
deleteOption()
deleteOption(
ticketFieldId
,optionID
):Promise
<void
>
Deletes a specific option of a ticket field by ID.
Parameters
• ticketFieldId: number
The ID of the ticket field.
• optionID: number
The ID of the option to delete.
Returns
Promise
<void
>
Throws
Throws an error if the request fails.
See
Example
const client = createClient({...});
await client.ticketfields.deleteOption(12345, 67890);
Defined in
clients/core/ticketfields.d.ts:316
emit()
emit(
eventType
,eventData
):void
Parameters
• eventType: any
• eventData: any
Returns
void
Inherited from
Defined in
clients/client.d.ts:43
get()
get(
resource
):Promise
<NodeModule
>
Parameters
• resource: any
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:62
getAll()
getAll(
resource
):Promise
<any
[]>
Parameters
• resource: any
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:77
list()
list():
Promise
<TicketField
[]>
Lists all ticket fields.
Returns
Promise
<TicketField
[]>
} Returns an array of ticket fields.
Throws
Throws an error if the request fails.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields
Example
const client = createClient({...});
const fields = await client.ticketfields.list();
Defined in
clients/core/ticketfields.d.ts:172
listOptions()
listOptions(
ticketFieldId
):Promise
<object
>
Lists all options of a ticket field.
Parameters
• ticketFieldId: number
The ID of the ticket field to retrieve options from.
Returns
Promise
<object
>
Returns an array of options for the ticket field.
response
response:
object
result
result:
object
[]
Throws
Throws an error if the request fails.
See
Example
const client = createClient({...});
const options = await client.ticketfields.listOptions(12345);
Defined in
clients/core/ticketfields.d.ts:266
listWithLocale()
listWithLocale(
locale
):Promise
<TicketField
[]>
Lists all ticket fields with locale.
Parameters
• locale: string
The locale code to filter ticket fields (e.g., 'sv' for Swedish).
Returns
Promise
<TicketField
[]>
} Returns an array of ticket fields by locale.
Throws
Throws an error if the request fails.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#list-ticket-fields
Example
const client = createClient({...});
const fields = await client.ticketfields.listWithLocale('sv');
Defined in
clients/core/ticketfields.d.ts:183
on()
on(
eventType
,callback
):void
Parameters
• eventType: any
• callback: any
Returns
void
Inherited from
Defined in
clients/client.d.ts:44
patch()
patch(...
arguments_
):Promise
<void
|object
>
Patches a resource.
Parameters
• ...arguments_: any
[]
The resources or parts of the resource path followed by the body.
Returns
Promise
<void
| object
>
- Either void or response object
Inherited from
Defined in
clients/client.d.ts:68
post()
post(
resource
,body
):Promise
<NodeModule
>
Parameters
• resource: any
• body: any
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:70
put()
put(
resource
,body
):Promise
<NodeModule
>
Parameters
• resource: any
• body: any
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:69
request()
request<
T
>(method
,uri
, ...arguments_
):Promise
<NodeModule
>
Request method that handles various HTTP methods.
Type Parameters
• T
Parameters
• method: string
HTTP method (e.g., 'GET', 'POST').
• uri: string
The URI for the request.
• ...arguments_: any
[]
Additional arguments for the request.
Returns
Promise
<NodeModule
>
- The API response.
Inherited from
Defined in
clients/client.d.ts:96
requestAll()
requestAll(
method
,uri
, ...arguments_
):Promise
<any
[]>
Parameters
• method: any
• uri: any
• ...arguments_: any
[]
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:97
requestUpload()
requestUpload(
uri
,file
):Promise
<any
>
Parameters
• uri: any
• file: any
Returns
Promise
<any
>
Inherited from
Defined in
clients/client.d.ts:98
setSideLoad()
setSideLoad(
array
):void
Parameters
• array: any
Returns
void
Inherited from
Defined in
clients/client.d.ts:61
show()
show(
ticketFieldId
):Promise
<object
>
Retrieves a specific ticket field by ID.
Parameters
• ticketFieldId: number
The ID of the ticket field to retrieve.
Returns
Promise
<object
>
Returns the details of the ticket field.
response
response:
object
result
result:
TicketField
Throws
Throws an error if the request fails.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#show-ticket-field
Example
const client = createClient({...});
const field = await client.ticketfields.show(12345);
Defined in
clients/core/ticketfields.d.ts:194
showOption()
showOption(
ticketFieldId
,optionID
):Promise
<object
>
Retrieves a specific option of a ticket field by ID.
Parameters
• ticketFieldId: number
The ID of the ticket field.
• optionID: number
The ID of the option to retrieve.
Returns
Promise
<object
>
Returns the option details.
response
response:
object
result
result:
object
Throws
Throws an error if the request fails.
See
Example
const client = createClient({...});
const option = await client.ticketfields.showOption(12345, 67890);
Defined in
clients/core/ticketfields.d.ts:281
update()
update(
ticketFieldId
,ticketField
):Promise
<object
>
Updates a specific ticket field by ID.
Parameters
• ticketFieldId: number
The ID of the ticket field to update.
• ticketField: object
The updated properties of the ticket field.
Returns
Promise
<object
>
Returns the updated ticket field.
response
response:
object
result
result:
TicketField
Throws
Throws an error if the request fails.
See
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_fields/#update-ticket-field
Example
const client = createClient({...});
const updatedField = await client.ticketfields.update(12345, {
title: 'Updated Field'
});
Defined in
clients/core/ticketfields.d.ts:241