export type CreateApiRumV1OrgIdLogsArgs = {org_id: string, body: BodyInit}; export type CreateApiRumV1OrgIdLogsOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Ingest RUM log events * * POST /rum/v1/{org_id}/logs */ export const createApiRumV1OrgIdLogs = async (args: CreateApiRumV1OrgIdLogsArgs, options: CreateApiRumV1OrgIdLogsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "text/plain") if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/rum/v1/${encodeURIComponent(String(args.org_id))}/logs${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 };