export type PipelineCooldown = {duration?: number | undefined}; export type CreateApiV4PipelinesPipelineIdCooldownArgs = {pipeline_id: string, body: PipelineCooldown}; export type CreateApiV4PipelinesPipelineIdCooldownOptions = {baseUrl?: string | undefined, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pipeline Cooldown * * POST /v4/pipelines/{pipeline_id}/cooldown * * Also accepts auth: APIKeyCookie */ export const createApiV4PipelinesPipelineIdCooldown = async (args: CreateApiV4PipelinesPipelineIdCooldownArgs, options?: CreateApiV4PipelinesPipelineIdCooldownOptions) => { const {baseUrl = "https://www.mystic.ai", fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v4/pipelines/${encodeURIComponent(String(args.pipeline_id))}/cooldown${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 };