export type Step = {type?: string | undefined, id?: string | undefined, attributes?: ({name?: string | undefined, output?: string | undefined, status?: ('pending' | 'waitingApproval' | 'approved' | 'queue' | 'running' | 'completed' | 'rejected' | 'cancelled' | 'failed') | undefined, stepNumber?: number | undefined}) | undefined, relationships?: ({job?: ({id?: string | undefined, type?: 'job' | undefined}) | undefined}) | undefined}; export type PatchApiStepStepIdArgs = {body: {data?: Step | undefined}}; export type PatchApiStepStepIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Modifies an instance of type step * * PATCH /step/{stepId} */ export const patchApiStepStepId = async (args: PatchApiStepStepIdArgs, options: PatchApiStepStepIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") const url = `${baseUrl.replace(/\/+$/, '')}/step/${encodeURIComponent(String(args.stepId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };