fix: Cron response types

This commit is contained in:
bracesproul
2025-01-10 10:01:51 -08:00
parent 10d46acc60
commit c624ff69e1
2 changed files with 19 additions and 4 deletions
+5 -4
View File
@@ -18,6 +18,7 @@ import {
ListNamespaceResponse,
Item,
ThreadStatus,
CronCreateResponse,
} from "./schema.js";
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
import {
@@ -184,7 +185,7 @@ export class CronsClient extends BaseClient {
threadId: string,
assistantId: string,
payload?: CronsCreatePayload,
): Promise<Run> {
): Promise<CronCreateResponse> {
const json: Record<string, any> = {
schedule: payload?.schedule,
input: payload?.input,
@@ -197,7 +198,7 @@ export class CronsClient extends BaseClient {
multitask_strategy: payload?.multitaskStrategy,
if_not_exists: payload?.ifNotExists,
};
return this.fetch<Run>(`/threads/${threadId}/runs/crons`, {
return this.fetch<CronCreateResponse>(`/threads/${threadId}/runs/crons`, {
method: "POST",
json,
});
@@ -212,7 +213,7 @@ export class CronsClient extends BaseClient {
async create(
assistantId: string,
payload?: CronsCreatePayload,
): Promise<Run> {
): Promise<CronCreateResponse> {
const json: Record<string, any> = {
schedule: payload?.schedule,
input: payload?.input,
@@ -225,7 +226,7 @@ export class CronsClient extends BaseClient {
multitask_strategy: payload?.multitaskStrategy,
if_not_exists: payload?.ifNotExists,
};
return this.fetch<Run>(`/runs/crons`, {
return this.fetch<CronCreateResponse>(`/runs/crons`, {
method: "POST",
json,
});
+14
View File
@@ -278,3 +278,17 @@ 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<string, unknown>;
schedule: string;
next_run_date: string;
end_time: string | undefined;
created_at: string;
updated_at: string;
metadata: Metadata;
}