export type CreateApiNotteSessionsSessionIdCookiesArgs = {session_id: string, body: {cookies: Array<{name: string, value: string, domain: string, path: string, httpOnly: boolean, secure?: boolean | undefined, sameSite?: string | undefined}>}}; export type CreateApiNotteSessionsSessionIdCookiesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set cookies in the browser session. * * POST /notte/sessions/{session_id}/cookies */ export const createApiNotteSessionsSessionIdCookies = async (args: CreateApiNotteSessionsSessionIdCookiesArgs, options?: CreateApiNotteSessionsSessionIdCookiesOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.session_id != null) query.append("session_id", String(args.session_id)) const url = `${baseUrl.replace(/\/+$/, '')}/notte/sessions/${encodeURIComponent(String(args.session_id))}/cookies${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 };