| 385 | } |
| 386 | |
| 387 | async registerSchedule(client: string, id: string, key: string, payload: ScheduleMetadata) { |
| 388 | const apiKey = await this.#apiKey(); |
| 389 | |
| 390 | this.#logger.debug("registering schedule", { |
| 391 | id, |
| 392 | payload, |
| 393 | }); |
| 394 | |
| 395 | const response = await zodfetch( |
| 396 | RegisterScheduleResponseBodySchema, |
| 397 | `${this.#apiUrl}/api/v1/${client}/schedules/${id}/registrations`, |
| 398 | { |
| 399 | method: "POST", |
| 400 | headers: { |
| 401 | "Content-Type": "application/json", |
| 402 | Authorization: `Bearer ${apiKey}`, |
| 403 | }, |
| 404 | body: JSON.stringify({ id: key, ...payload }), |
| 405 | } |
| 406 | ); |
| 407 | |
| 408 | return response; |
| 409 | } |
| 410 | |
| 411 | async unregisterSchedule(client: string, id: string, key: string) { |
| 412 | const apiKey = await this.#apiKey(); |