Skip to content

node-zendesk / Exports / clients/core/activitystream / ActivityStream

Class: ActivityStream

clients/core/activitystream.ActivityStream

ActivityStream provides methods to interact with Zendesk ticket activities. This class extends the base Client class and is tailored to fetch activity data.

See

Zendesk Activity Stream API

Example

ts
const client = new Client({ /* ...options... * / });
const activities = await client.activitystream.list();

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new ActivityStream(options): ActivityStream

Creates an instance of the ActivityStream client.

Parameters

NameTypeDescription
optionsobjectConfiguration options for the client.

Returns

ActivityStream

Overrides

Client.constructor

Defined in

clients/core/activitystream.d.ts:16

Properties

_transporter

_transporter: Transporter

Inherited from

Client._transporter

Defined in

clients/client.d.ts:94


eventTarget

eventTarget: CustomEventTarget

Event target to handle custom events.

Inherited from

Client.eventTarget

Defined in

clients/client.d.ts:92


jsonAPINames

jsonAPINames: string[]

Array to hold names used in the JSON API.

Overrides

Client.jsonAPINames

Defined in

clients/core/activitystream.d.ts:17


options

options: ClientOptions & { get: (key: string) => any }

Configuration options for the client.

Inherited from

Client.options

Defined in

clients/client.d.ts:86


sideLoad

sideLoad: any[]

Array to handle side-loaded resources.

Inherited from

Client.sideLoad

Defined in

clients/client.d.ts:89


useDotJson

useDotJson: boolean

Flag to indicate if the API endpoint should use '.json' ending.

Inherited from

Client.useDotJson

Defined in

clients/client.d.ts:91

Accessors

transporter

get transporter(): Transporter

Transporter for making requests.

Returns

Transporter

Inherited from

Client.transporter

Defined in

clients/client.d.ts:93

Methods

_rawRequest

_rawRequest(method, uri, ...args): Promise<{ response: any ; result: {} }>

Parameters

NameType
methodany
uriany
...argsany[]

Returns

Promise<{ response: any ; result: {} }>

Inherited from

Client._rawRequest

Defined in

clients/client.d.ts:130


count

count(): Promise<object>

Returns an approximate count of ticket activities in the last 30 days affecting the agent making the request. If the count exceeds 100,000, the count will return a cached result which updates every 24 hours.

The count[refreshed_at] property is a timestamp that indicates when the count was last updated. Note: When the count exceeds 100,000, count[refreshed_at] may occasionally be null. This indicates that the count is being updated in the background, and count[value] is limited to 100,000 until the update is complete.

Returns

Promise<object>

A promise that resolves to an object containing the activity count and the refreshed_at timestamp.

Async

See

Zendesk API - Count Activities

Example

ts
const activityCount = await client.activitystream.count();
console.log(activityCount); // { count: { refreshed_at: "2020-04-06T02:18:17Z", value: 102 } }

Defined in

clients/core/activitystream.d.ts:51


delete

delete(...args): Promise<void | object>

Deletes a resource.

Parameters

NameTypeDescription
...argsany[]The resources or parts of the resource path.

Returns

Promise<void | object>

  • Either void or response object

Inherited from

Client.delete

Defined in

clients/client.d.ts:128


emit

emit(eventType, eventData): void

Parameters

NameType
eventTypeany
eventDataany

Returns

void

Inherited from

Client.emit

Defined in

clients/client.d.ts:95


get

get(resource): Promise<NodeModule>

Parameters

NameType
resourceany

Returns

Promise<NodeModule>

Inherited from

Client.get

Defined in

clients/client.d.ts:114


getAll

getAll(resource): Promise<any[]>

Parameters

NameType
resourceany

Returns

Promise<any[]>

Inherited from

Client.getAll

Defined in

clients/client.d.ts:129


list

list(): object[]

Lists all ticket activities from the Zendesk API.

Returns

object[]

An array of activity objects.

Async

See

Zendesk API - List Activities

Example

ts
const activities = await client.activitystream.list();

Defined in

clients/core/activitystream.d.ts:26


on

on(eventType, callback): void

Parameters

NameType
eventTypeany
callbackany

Returns

void

Inherited from

Client.on

Defined in

clients/client.d.ts:96


patch

patch(...args): Promise<void | object>

Patches a resource.

Parameters

NameTypeDescription
...argsany[]The resources or parts of the resource path followed by the body.

Returns

Promise<void | object>

  • Either void or response object

Inherited from

Client.patch

Defined in

clients/client.d.ts:120


post

post(resource, body): Promise<NodeModule>

Parameters

NameType
resourceany
bodyany

Returns

Promise<NodeModule>

Inherited from

Client.post

Defined in

clients/client.d.ts:122


put

put(resource, body): Promise<NodeModule>

Parameters

NameType
resourceany
bodyany

Returns

Promise<NodeModule>

Inherited from

Client.put

Defined in

clients/client.d.ts:121


request

request<T>(method, uri, ...args): Promise<NodeModule>

Request method that handles various HTTP methods.

Type parameters

Name
T

Parameters

NameTypeDescription
methodstringHTTP method (e.g., 'GET', 'POST').
uristringThe URI for the request.
...argsany[]Additional arguments for the request.

Returns

Promise<NodeModule>

  • The API response.

Inherited from

Client.request

Defined in

clients/client.d.ts:148


requestAll

requestAll(method, uri, ...args): Promise<any[]>

Parameters

NameType
methodany
uriany
...argsany[]

Returns

Promise<any[]>

Inherited from

Client.requestAll

Defined in

clients/client.d.ts:149


requestUpload

requestUpload(uri, file): Promise<any>

Parameters

NameType
uriany
fileany

Returns

Promise<any>

Inherited from

Client.requestUpload

Defined in

clients/client.d.ts:150


setSideLoad

setSideLoad(array): void

Parameters

NameType
arrayany

Returns

void

Inherited from

Client.setSideLoad

Defined in

clients/client.d.ts:113


show

show(activityID): Promise<object>

Retrieves a specific ticket activity by its ID.

Parameters

NameTypeDescription
activityIDnumberThe unique ID of the activity to fetch.

Returns

Promise<object>

A promise that resolves to the activity object corresponding to the provided activityID.

Async

See

Zendesk API - Show Activity

Example

ts
const activity = await client.activitystream.show(12345);  // Where 12345 is an activity ID.

Defined in

clients/core/activitystream.d.ts:36

Released under the MIT License.