export type ScheduleOverlapPolicy = 1 | 2 | 3 | 4 | 5 | 6; export type WorkflowScheduleTriggerRequest = {overlap?: (ScheduleOverlapPolicy | null) | undefined}; export type CreateApiV1WorkflowsSchedulesScheduleIdTriggerArgs = {schedule_id: string, body: WorkflowScheduleTriggerRequest | null}; export type CreateApiV1WorkflowsSchedulesScheduleIdTriggerOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Trigger Schedule * * POST /v1/workflows/schedules/{schedule_id}/trigger */ export const createApiV1WorkflowsSchedulesScheduleIdTrigger = async (args: CreateApiV1WorkflowsSchedulesScheduleIdTriggerArgs, options?: CreateApiV1WorkflowsSchedulesScheduleIdTriggerOptions) => { const {baseUrl = "https://api.mistral.ai", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/workflows/schedules/${encodeURIComponent(String(args.schedule_id))}/trigger${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };