(
runId: string,
task: RunTaskBodyInput,
options: { cachedTasksCursor?: string } = {}
)
| 136 | } |
| 137 | |
| 138 | async runTask( |
| 139 | runId: string, |
| 140 | task: RunTaskBodyInput, |
| 141 | options: { cachedTasksCursor?: string } = {} |
| 142 | ) { |
| 143 | const apiKey = await this.#apiKey(); |
| 144 | |
| 145 | this.#logger.debug(`[ApiClient] runTask ${task.displayKey}`); |
| 146 | |
| 147 | return await zodfetchWithVersions( |
| 148 | this.#logger, |
| 149 | { |
| 150 | [API_VERSIONS.LAZY_LOADED_CACHED_TASKS]: RunTaskResponseWithCachedTasksBodySchema, |
| 151 | }, |
| 152 | ServerTaskSchema, |
| 153 | `${this.#apiUrl}/api/v1/runs/${runId}/tasks`, |
| 154 | { |
| 155 | method: "POST", |
| 156 | headers: { |
| 157 | "Content-Type": "application/json", |
| 158 | Authorization: `Bearer ${apiKey}`, |
| 159 | "Idempotency-Key": task.idempotencyKey, |
| 160 | "X-Cached-Tasks-Cursor": options.cachedTasksCursor ?? "", |
| 161 | "Trigger-Version": API_VERSIONS.LAZY_LOADED_CACHED_TASKS, |
| 162 | }, |
| 163 | body: JSON.stringify(task), |
| 164 | } |
| 165 | ); |
| 166 | } |
| 167 | |
| 168 | async completeTask(runId: string, id: string, task: CompleteTaskBodyV2Input) { |
| 169 | const apiKey = await this.#apiKey(); |
nothing calls this directly
no test coverage detected