node-zendesk / Exports / clients/core/views / Views
Class: Views
clients/core/views.Views
Represents the Views API methods.
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/
Hierarchy
↳
Views
Table of contents
Constructors
Properties
Accessors
Methods
- _rawRequest
- create
- delete
- emit
- execute
- export
- get
- getAll
- list
- listActive
- listActiveShared
- listCompact
- on
- patch
- post
- preview
- put
- reorder
- request
- requestAll
- requestUpload
- setSideLoad
- show
- showCount
- showCounts
- showExecutionStatus
- showRecentTicketIDs
- tickets
- update
Constructors
constructor
• new Views(options
): Views
Parameters
Name | Type |
---|---|
options | any |
Returns
Overrides
Defined in
clients/core/views.d.ts:6
Properties
_transporter
• _transporter: Transporter
Inherited from
Defined in
clients/client.d.ts:94
eventTarget
• eventTarget: CustomEventTarget
Event target to handle custom events.
Inherited from
Defined in
clients/client.d.ts:92
jsonAPINames
• jsonAPINames: string
[]
Array to hold names used in the JSON API.
Overrides
Defined in
clients/core/views.d.ts:7
options
• options: ClientOptions
& { get
: (key
: string
) => any
}
Configuration options for the client.
Inherited from
Defined in
clients/client.d.ts:86
sideLoad
• sideLoad: any
[]
Array to handle side-loaded resources.
Inherited from
Defined in
clients/client.d.ts:89
useDotJson
• useDotJson: boolean
Flag to indicate if the API endpoint should use '.json' ending.
Inherited from
Defined in
clients/client.d.ts:91
Accessors
transporter
• get
transporter(): Transporter
Transporter for making requests.
Returns
Inherited from
Client.transporter
Defined in
clients/client.d.ts:93
Methods
_rawRequest
▸ _rawRequest(method
, uri
, ...args
): Promise
<{ response
: any
; result
: {} }>
Parameters
Name | Type |
---|---|
method | any |
uri | any |
...args | any [] |
Returns
Promise
<{ response
: any
; result
: {} }>
Inherited from
Defined in
clients/client.d.ts:130
create
▸ create(view
): Promise
<object
>
Creates a new view.
Parameters
Name | Type | Description |
---|---|---|
view | object | The view data to create. |
Returns
Promise
<object
>
A promise that resolves to the created view details.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#create-view
Example
const newView = {
title: "My New View",
conditions: {...}
};
const createdView = await client.views.create(newView);
Defined in
clients/core/views.d.ts:58
delete
▸ delete(viewID
): Promise
<object
>
Deletes a specific view by its ID.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to delete. |
Returns
Promise
<object
>
A promise that resolves when the view is deleted.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#delete-view
Overrides
Defined in
clients/core/views.d.ts:163
emit
▸ emit(eventType
, eventData
): void
Parameters
Name | Type |
---|---|
eventType | any |
eventData | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:95
execute
▸ execute(viewID
, parameters
): Promise
<object
>
Executes a specific view by its ID.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to execute. |
parameters | object | Additional parameters for execution. |
Returns
Promise
<object
>
A promise that resolves to the executed view results.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#execute-view
Example
const executedView = await client.views.execute(12345, {sort_by: 'status'});
Defined in
clients/core/views.d.ts:82
export
▸ export(viewID
): Promise
<object
>
Exports views to a JSON file.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to export. |
Returns
Promise
<object
>
A promise that resolves to the exported views in JSON format.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#export-view
Example
const exportedViews = await client.views.export([12345, 67890]);
Defined in
clients/core/views.d.ts:132
get
▸ get(resource
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:114
getAll
▸ getAll(resource
): Promise
<any
[]>
Parameters
Name | Type |
---|---|
resource | any |
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:129
list
▸ list(): Promise
<object
>
Lists shared and personal views available to the current user.
Returns
Promise
<object
>
A promise that resolves to the list of views.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-views
Example
const views = await client.views.list();
Defined in
clients/core/views.d.ts:16
listActive
▸ listActive(): Promise
<object
>
Lists active shared and personal views available to the current user.
Returns
Promise
<object
>
A promise that resolves to the list of active views.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-active-views
Example
const activeViews = await client.views.listActive();
Defined in
clients/core/views.d.ts:25
listActiveShared
▸ listActiveShared(): Promise
<object
>
Retrieves all active shared views.
Returns
Promise
<object
>
A promise that resolves to the list of all active shared views.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-active-shared-views
Defined in
clients/core/views.d.ts:139
listCompact
▸ listCompact(): Promise
<object
>
A compacted list of shared and personal views available to the current user.
Returns
Promise
<object
>
A promise that resolves to the compact list of views.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-views-compact
Example
const compactViews = await client.views.listCompact();
Defined in
clients/core/views.d.ts:34
on
▸ on(eventType
, callback
): void
Parameters
Name | Type |
---|---|
eventType | any |
callback | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:96
patch
▸ patch(...args
): Promise
<void
| object
>
Patches a resource.
Parameters
Name | Type | Description |
---|---|---|
...args | 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:120
post
▸ post(resource
, body
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
body | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:122
preview
▸ preview(parameters
): Promise
<object
>
Previews a new view without saving it.
Parameters
Name | Type | Description |
---|---|---|
parameters | object | Additional parameters for execution. |
Returns
Promise
<object
>
A promise that resolves to the previewed view results.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#preview-view
Example
const viewData = {
title: "Preview View",
conditions: {...}
};
const previewResults = await client.views.preview(viewData);
Defined in
clients/core/views.d.ts:105
put
▸ put(resource
, body
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
body | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:121
reorder
▸ reorder(viewOrder
): Promise
<object
>
Reorders views based on the provided order.
Parameters
Name | Type | Description |
---|---|---|
viewOrder | number [] | An array of view IDs in the desired order. |
Returns
Promise
<object
>
A promise that resolves when the views are reordered.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#reorder-views
Defined in
clients/core/views.d.ts:171
request
▸ request<T
>(method
, uri
, ...args
): Promise
<NodeModule
>
Request method that handles various HTTP methods.
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
method | string | HTTP method (e.g., 'GET', 'POST'). |
uri | string | The URI for the request. |
...args | any [] | Additional arguments for the request. |
Returns
Promise
<NodeModule
>
- The API response.
Inherited from
Defined in
clients/client.d.ts:148
requestAll
▸ requestAll(method
, uri
, ...args
): Promise
<any
[]>
Parameters
Name | Type |
---|---|
method | any |
uri | any |
...args | any [] |
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:149
requestUpload
▸ requestUpload(uri
, file
): Promise
<any
>
Parameters
Name | Type |
---|---|
uri | any |
file | any |
Returns
Promise
<any
>
Inherited from
Defined in
clients/client.d.ts:150
setSideLoad
▸ setSideLoad(array
): void
Parameters
Name | Type |
---|---|
array | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:113
show
▸ show(viewID
): Promise
<object
>
Shows details of a specific view.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to retrieve. |
Returns
Promise
<object
>
A promise that resolves to the details of the view.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view
Example
const viewDetails = await client.views.show(12345);
Defined in
clients/core/views.d.ts:44
showCount
▸ showCount(viewID
): Promise
<object
>
Retrieves the count of tickets for a specific view.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to count tickets for. |
Returns
Promise
<object
>
A promise that resolves to the ticket count for the view.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#show-view-count
Example
const ticketCount = await client.views.showCount(12345);
Defined in
clients/core/views.d.ts:114
showCounts
▸ showCounts(viewIDs
): Promise
<object
>
Retrieves the ticket counts for multiple views.
Parameters
Name | Type | Description |
---|---|---|
viewIDs | number [] | An array of view IDs to count tickets for. |
Returns
Promise
<object
>
A promise that resolves to the ticket counts for the specified views.
Async
See
Example
const ticketCounts = await client.views.showCounts([12345, 67890]);
Defined in
clients/core/views.d.ts:123
showExecutionStatus
▸ showExecutionStatus(viewID
): Promise
<object
>
Retrieves the view's execution status.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to check the execution status for. |
Returns
Promise
<object
>
A promise that resolves to the execution status of the view.
Async
See
Defined in
clients/core/views.d.ts:147
showRecentTicketIDs
▸ showRecentTicketIDs(viewID
): Promise
<object
>
Retrieves the view's recent ticket IDs.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to retrieve recent ticket IDs for. |
Returns
Promise
<object
>
A promise that resolves to the recent ticket IDs of the view.
Async
See
Defined in
clients/core/views.d.ts:155
tickets
▸ tickets(viewID
): Promise
<object
>
Retrieves tickets from a specific view by its ID.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view. |
Returns
Promise
<object
>
A promise that resolves to the list of tickets from the view.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-tickets-from-a-view
Example
const ticketsFromView = await client.views.tickets(12345);
Defined in
clients/core/views.d.ts:91
update
▸ update(viewID
, viewData
): Promise
<object
>
Updates an existing view by its ID.
Parameters
Name | Type | Description |
---|---|---|
viewID | number | The ID of the view to update. |
viewData | object | The updated view data. |
Returns
Promise
<object
>
A promise that resolves to the updated view details.
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#update-view
Example
const updatedData = {
title: "Updated View Title"
};
const updatedView = await client.views.update(12345, updatedData);
Defined in
clients/core/views.d.ts:72