export type CreateApiExperimentalFlowInstancesInstanceIdCancelArgs = {instance_id: string}; export type CreateApiExperimentalFlowInstancesInstanceIdCancelOptions = {baseUrl?: string | undefined, OAuth10?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel Flow instance * * POST /experimental/flow/instances/{instance_id}/cancel * * Also accepts auth: OAuth2.0, SessionCookie + XToken */ export const createApiExperimentalFlowInstancesInstanceIdCancel = async (args: CreateApiExperimentalFlowInstancesInstanceIdCancelArgs, options?: CreateApiExperimentalFlowInstancesInstanceIdCancelOptions) => { const {baseUrl = "https://scrive.com", fetch: fetchFn = fetch, OAuth10} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (OAuth10 !== undefined) headers.set('authorization', `oauth1 ${OAuth10}`) const url = `${baseUrl.replace(/\/+$/, '')}/experimental/flow/instances/${encodeURIComponent(String(args.instance_id))}/cancel${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };