export type CreateApiV3SourcemapsLogIdArgs = {logId: string, body: BodyInit}; export type CreateApiV3SourcemapsLogIdOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create or update a translation between a minified JavaScript path to the minified JavaScript and source map files. * * POST /v3/sourcemaps/{logId} */ export const createApiV3SourcemapsLogId = async (args: CreateApiV3SourcemapsLogIdArgs, options: CreateApiV3SourcemapsLogIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) query.set("api_key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v3/sourcemaps/${encodeURIComponent(String(args.logId))}${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 };