diff --git a/libs/sdk-js/src/client.ts b/libs/sdk-js/src/client.ts index b340274ca..fd69e41aa 100644 --- a/libs/sdk-js/src/client.ts +++ b/libs/sdk-js/src/client.ts @@ -18,6 +18,8 @@ import { ListNamespaceResponse, Item, ThreadStatus, + CronCreateResponse, + CronCreateForThreadResponse, } from "./schema.js"; import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js"; import { @@ -184,7 +186,7 @@ export class CronsClient extends BaseClient { threadId: string, assistantId: string, payload?: CronsCreatePayload, - ): Promise { + ): Promise { const json: Record = { schedule: payload?.schedule, input: payload?.input, @@ -197,10 +199,13 @@ export class CronsClient extends BaseClient { multitask_strategy: payload?.multitaskStrategy, if_not_exists: payload?.ifNotExists, }; - return this.fetch(`/threads/${threadId}/runs/crons`, { - method: "POST", - json, - }); + return this.fetch( + `/threads/${threadId}/runs/crons`, + { + method: "POST", + json, + }, + ); } /** @@ -212,7 +217,7 @@ export class CronsClient extends BaseClient { async create( assistantId: string, payload?: CronsCreatePayload, - ): Promise { + ): Promise { const json: Record = { schedule: payload?.schedule, input: payload?.input, @@ -225,7 +230,7 @@ export class CronsClient extends BaseClient { multitask_strategy: payload?.multitaskStrategy, if_not_exists: payload?.ifNotExists, }; - return this.fetch(`/runs/crons`, { + return this.fetch(`/runs/crons`, { method: "POST", json, }); diff --git a/libs/sdk-js/src/schema.ts b/libs/sdk-js/src/schema.ts index 259bcd539..6d6621012 100644 --- a/libs/sdk-js/src/schema.ts +++ b/libs/sdk-js/src/schema.ts @@ -278,3 +278,22 @@ export interface SearchItem extends Item { export interface SearchItemsResponse { items: SearchItem[]; } + +export interface CronCreateResponse { + cron_id: string; + assistant_id: string; + thread_id: string | undefined; + user_id: string; + payload: Record; + schedule: string; + next_run_date: string; + end_time: string | undefined; + created_at: string; + updated_at: string; + metadata: Metadata; +} + +export interface CronCreateForThreadResponse + extends Omit { + thread_id: string; +}