node-zendesk • Docs
node-zendesk / clients/core/views / Views
Class: Views
Represents the Views API methods.
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/
Extends
Constructors
new Views()
new Views(
options
):Views
Parameters
• options: any
Returns
Overrides
Defined in
clients/core/views.d.ts:6
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/views.d.ts:7
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(
view
):Promise
<object
>
Creates a new view.
Parameters
• view: object
The view data to create.
Returns
Promise
<object
>
A promise that resolves to the created view details.
response
response:
object
result
result:
object
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:56
delete()
delete(
viewID
):Promise
<object
>
Deletes a specific view by its ID.
Parameters
• viewID: number
The ID of the view to delete.
Returns
Promise
<object
>
A promise that resolves when the view is deleted.
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#delete-view
Overrides
Defined in
clients/core/views.d.ts:174
emit()
emit(
eventType
,eventData
):void
Parameters
• eventType: any
• eventData: any
Returns
void
Inherited from
Defined in
clients/client.d.ts:43
execute()
execute(
viewID
,parameters
):Promise
<object
>
Executes a specific view by its ID.
Parameters
• 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.
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:84
export()
export(
viewID
):Promise
<object
>
Exports views to a JSON file.
Parameters
• viewID: number
The ID of the view to export.
Returns
Promise
<object
>
A promise that resolves to the exported views in JSON format.
response
response:
object
result
result:
object
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:135
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
<object
>
Lists shared and personal views available to the current user.
Returns
Promise
<object
>
A promise that resolves to the list of views.
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:15
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.
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:23
listActiveShared()
listActiveShared():
Promise
<object
>
Retrieves all active shared views.
Returns
Promise
<object
>
A promise that resolves to the list of all active shared views.
response
response:
object
result
result:
object
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-active-shared-views
Defined in
clients/core/views.d.ts:144
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.
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:31
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
preview()
preview(
parameters
):Promise
<object
>
Previews a new view without saving it.
Parameters
• parameters: object
Additional parameters for execution.
Returns
Promise
<object
>
A promise that resolves to the previewed view results.
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
• resource: any
• body: any
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:69
reorder()
reorder(
viewOrder
):Promise
<object
>
Reorders views based on the provided order.
Parameters
• viewOrder: number
[]
An array of view IDs in the desired order.
Returns
Promise
<object
>
A promise that resolves when the views are reordered.
response
response:
object
result
result:
object
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#reorder-views
Defined in
clients/core/views.d.ts:181
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(
viewID
):Promise
<object
>
Shows details of a specific view.
Parameters
• viewID: number
The ID of the view to retrieve.
Returns
Promise
<object
>
A promise that resolves to the details of the view.
response
response:
object
result
result:
object
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:40
showCount()
showCount(
viewID
):Promise
<object
>
Retrieves the count of tickets for a specific view.
Parameters
• 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.
response
response:
object
result
result:
object
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:113
showCounts()
showCounts(
viewIDs
):Promise
<object
>
Retrieves the ticket counts for multiple views.
Parameters
• 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.
response
response:
object
result
result:
object
See
Example
const ticketCounts = await client.views.showCounts([12345, 67890]);
Defined in
clients/core/views.d.ts:124
showExecutionStatus()
showExecutionStatus(
viewID
):Promise
<object
>
Retrieves the view's execution status.
Parameters
• 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.
response
response:
object
result
result:
object
See
Defined in
clients/core/views.d.ts:154
showRecentTicketIDs()
showRecentTicketIDs(
viewID
):Promise
<object
>
Retrieves the view's recent ticket IDs.
Parameters
• 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.
response
response:
object
result
result:
object
See
Defined in
clients/core/views.d.ts:164
tickets()
tickets(
viewID
):Promise
<object
>
Retrieves tickets from a specific view by its ID.
Parameters
• viewID: number
The ID of the view.
Returns
Promise
<object
>
A promise that resolves to the list of tickets from the view.
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:92
update()
update(
viewID
,viewData
):Promise
<object
>
Updates an existing view by its ID.
Parameters
• 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.
response
response:
object
result
result:
object
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