AsyncTasksAPI
Defined in: src/api/asyncTasks.api.ts:24
Async Tasks API client for polling long-running Notion operations.
Extends
Section titled “Extends”BaseAPI<NotionAsyncTask,AsyncTask>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AsyncTasksAPI(
client):AsyncTasksAPI
Defined in: src/api/asyncTasks.api.ts:30
Parameters
Section titled “Parameters”client
Section titled “client”NotionClient
Returns
Section titled “Returns”AsyncTasksAPI
Overrides
Section titled “Overrides”BaseAPI<NotionAsyncTask, AsyncTask>.constructor
Methods
Section titled “Methods”poll()
Section titled “poll()”poll(
taskId,options?):Promise<AsyncTask>
Defined in: src/api/asyncTasks.api.ts:57
Poll an async task until it reaches a terminal status: succeeded or failed.
Wait at least poll_after_seconds between each poll, per the API’s guidance.
This value comes from the response body, not a header.
Parameters
Section titled “Parameters”taskId
Section titled “taskId”string
The ID of the async task to poll
options?
Section titled “options?”PollAsyncTaskOptions
Polling options
Returns
Section titled “Returns”Promise<AsyncTask>
The task wrapped in an AsyncTask model, once it reaches a terminal status
Throws
Section titled “Throws”If the task doesn’t complete within timeoutMs
retrieve()
Section titled “retrieve()”retrieve(
taskId):Promise<AsyncTask>
Defined in: src/api/asyncTasks.api.ts:42
Retrieve the current status of an async task.
Parameters
Section titled “Parameters”taskId
Section titled “taskId”string
The ID of the async task to retrieve
Returns
Section titled “Returns”Promise<AsyncTask>
The task wrapped in an AsyncTask model