space.schedule.list()
Walk every job in the project, or read one page at a time.
Lists the project’s jobs, newest first. Walk them all with for await, collect them with all(), or read one page at a time with page().
function list(options?: CallOptions): Paged<Job>
interface Paged<T> extends AsyncIterable<T> {
page(cursor?: string | null): Promise<Page<T>>
all(): Promise<T[]>
}
interface Page<T> {
items: T[]
nextCursor: string | null
}Parameters
options.signalAbortSignalCancels every request the list makes.
options.timeoutMsnumberHow long each page may take, in milliseconds. The
timeoutMsset increateSpacewhen you leave it out, 30,000 by default.
Returns
A Paged<Job> of jobs, straight away rather than a promise. Nothing is fetched until you read it:
for await (const job of space.schedule.list())fetches page after page, up to 200 jobs each, until there are no more.all()does the same and returns every job in one list.page(cursor)fetches one page. Pass thenextCursorof the page before to get the next one; it isnullon the last page.
Each page is fetched again, up to retries times, when it fails in a way that may pass, such as a network failure or 503.
Errors
Reading the list rejects with a SpaceError, such as unauthenticated, forbidden, missing_project, or network_error. See SpaceError.
Example
import { space } from "digitospace"
for await (const job of space.schedule.list()) {
console.log(job.name, job.state, job.nextRunAt ?? "paused")
}Read one page at a time
import { space } from "digitospace"
const jobs = space.schedule.list()
const first = await jobs.page()
console.log(first.items.length)
if (first.nextCursor) {
const second = await jobs.page(first.nextCursor)
console.log(second.items.length)
}Last updated