export type CreateApiLogsPartitionNameArgs = {partition_name: string}; export type CreateApiLogsPartitionNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Decision log service * * POST /logs/{partition_name} */ export const createApiLogsPartitionName = async (args: CreateApiLogsPartitionNameArgs, options: CreateApiLogsPartitionNameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/gzip") const url = `${baseUrl.replace(/\/+$/, '')}/logs/${encodeURIComponent(String(args.partition_name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };