export type EventProlongInstance = {days: number}; export type CreateApiExperimentalFlowInstancesInstanceIdProlongArgs = {instance_id: string, body: EventProlongInstance}; export type CreateApiExperimentalFlowInstancesInstanceIdProlongOptions = {baseUrl?: string | undefined, OAuth10?: string | undefined, fetch?: typeof fetch | undefined}; /** * Prolong timeout date * * POST /experimental/flow/instances/{instance_id}/prolong * * Also accepts auth: OAuth2.0, SessionCookie + XToken */ export const createApiExperimentalFlowInstancesInstanceIdProlong = async (args: CreateApiExperimentalFlowInstancesInstanceIdProlongArgs, options?: CreateApiExperimentalFlowInstancesInstanceIdProlongOptions) => { const {baseUrl = "https://scrive.com", fetch: fetchFn = fetch, OAuth10} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json;charset=utf-8") if (OAuth10 !== undefined) headers.set('authorization', `oauth1 ${OAuth10}`) const url = `${baseUrl.replace(/\/+$/, '')}/experimental/flow/instances/${encodeURIComponent(String(args.instance_id))}/prolong${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 };