Skip to content

SDK API Reference / ScheduleSDK

Class: ScheduleSDK

Schedule API - manage scheduled queries

Methods

create()

create(name, request): Promise<ScheduleReference>

Create a new schedule

Parameters

name

string

Schedule name

request

CreateScheduleRequest

Schedule creation parameters

Returns

Promise<ScheduleReference>

Created schedule reference


delete()

delete(name): Promise<ScheduleReference>

Delete a schedule

Parameters

name

string

Schedule name

Returns

Promise<ScheduleReference>

Deleted schedule reference


history()

history(name, options?): Promise<ScheduleHistoryResponse>

Get schedule execution history

Parameters

name

string

Schedule name

options?

Pagination options

from?

number

Starting offset (default: 0)

to?

number

Ending offset (default: 20)

Returns

Promise<ScheduleHistoryResponse>

Schedule history with normalized timestamps


list()

list(options?): Promise<Schedule[]>

List schedules (v3 API - deprecated for listing)

Note: The TD API /v3/schedule/list does not support server-side pagination. For accounts with many schedules, use the limit option to control display. Prefer listQueries() for better performance and query IDs.

Parameters

options?

List options

limit?

number

Maximum number of schedules to return (client-side limit)

Returns

Promise<Schedule[]>

Array of schedules with normalized timestamps


listQueries()

listQueries(options?): Promise<V4QueriesResponse>

List queries using v4 API with pagination

Returns saved/scheduled queries with proper IDs and last_job info. Sorted by updated_at descending (most recently run first) by default.

Parameters

options?

List options

limit?

number

Maximum number of queries to return

pattern?

string

Regex pattern to filter query names

scheduled?

boolean

If true, only return scheduled queries (with cron)

Returns

Promise<V4QueriesResponse>

Paginated queries response with query IDs


run()

run(name, options?): Promise<RunScheduleResponse>

Run a schedule immediately

Parameters

name

string

Schedule name

options?

Run options

num?

number

Number of executions (1-10), defaults to 1

time?

string | Date

Scheduled time (ISO 8601 or Date), defaults to now

Returns

Promise<RunScheduleResponse>

Array of scheduled jobs


show()

show(name): Promise<Schedule>

Show schedule details by name

Parameters

name

string

Schedule name

Returns

Promise<Schedule>

Schedule details

Throws

SDKError if schedule not found


update()

update(name, request): Promise<ScheduleReference>

Update an existing schedule

Parameters

name

string

Schedule name

request

UpdateScheduleRequest

Schedule update parameters

Returns

Promise<ScheduleReference>

Updated schedule reference