node-zendesk • Docs
node-zendesk / clients/core/policies / Policies
Class: Policies
Represents the SLA Policies functionality of Zendesk.
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/
Extends
Constructors
new Policies()
new Policies(
options
):Policies
Constructs a new Policies instance.
Parameters
• options: object
Options to configure the client.
Returns
Overrides
Defined in
clients/core/policies.d.ts:10
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/policies.d.ts:11
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
create()
create(
policy
):Promise
<object
>
Create a new SLA Policy.
Parameters
• policy: object
The SLA Policy object to be created.
Returns
Promise
<object
>
- A promise that resolves to the newly created policy details.
response
response:
object
result
result:
object
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#create-sla-policy
Example
const newPolicy = {
title: "Incidents",
description: "For urgent incidents, we will respond to tickets in 10 minutes",
//... other policy properties
};
const createdPolicy = await client.policies.create(newPolicy);
Defined in
clients/core/policies.d.ts:43
delete()
delete(
policyID
):Promise
<void
>
Delete a specific SLA Policy.
Parameters
• policyID: number
The ID of the SLA Policy to be deleted.
Returns
Promise
<void
>
- A promise that resolves when the policy has been deleted.
Throws
Will throw an error if the deletion is unsuccessful.
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#delete-sla-policy
Example
await client.policies.delete(25);
Overrides
Defined in
clients/core/policies.d.ts:72
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
getDefinitions()
getDefinitions():
Promise
<object
>
Retrieve a list of supported filter definition items.
Returns
Promise
<object
>
The response from the Zendesk API containing supported filter definitions.
response
response:
object
result
result:
object
Throws
Throws an error if there's an issue with the request.
See
Example
const definitions = await client.policies.getDefinitions();
Defined in
clients/core/policies.d.ts:94
list()
list():
Promise
<object
>
List all the SLA Policies.
Returns
Promise
<object
>
- A promise that resolves to the list of policies.
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#list-sla-policies
Example
const policiesList = await client.policies.list();
Defined in
clients/core/policies.d.ts:18
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
reorder()
reorder(
slaPolicyIds
):Promise
<object
>
Reorder SLA Policies based on provided IDs.
Parameters
• slaPolicyIds: number
[]
Array of SLA policy IDs in the desired order.
Returns
Promise
<object
>
The response from the Zendesk API.
response
response:
object
result
result:
object
Throws
Throws an error if there's an issue with the request.
See
Example
const reorderedResponse = await client.policies.reorder([55, 12]);
Defined in
clients/core/policies.d.ts:82
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(
policyID
):Promise
<object
>
Show details of a specific SLA Policy.
Parameters
• policyID: number
The ID of the SLA Policy.
Returns
Promise
<object
>
- A promise that resolves to the policy details.
response
response:
object
result
result:
object
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#show-sla-policy
Example
const policyDetails = await client.policies.show(25);
Defined in
clients/core/policies.d.ts:26
update()
update(
policyID
,policy
):Promise
<object
>
Update an existing SLA Policy.
Parameters
• policyID: number
The ID of the SLA Policy to be updated.
• policy: object
The updated SLA Policy object.
Returns
Promise
<object
>
- A promise that resolves to the updated policy details.
response
response:
object
result
result:
object
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/sla_policies/#update-sla-policy
Example
const updatedPolicy = {
title: "Urgent Incidents",
//... other updated policy properties
};
const result = await client.policies.update(25, updatedPolicy);
Defined in
clients/core/policies.d.ts:60