export type CreateApiRumV1OrgIdReplayArgs = {org_id: string, body: BodyInit}; export type CreateApiRumV1OrgIdReplayOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Ingest session replay data * * POST /rum/v1/{org_id}/replay */ export const createApiRumV1OrgIdReplay = async (args: CreateApiRumV1OrgIdReplayArgs, options: CreateApiRumV1OrgIdReplayOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/rum/v1/${encodeURIComponent(String(args.org_id))}/replay${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };