export type CreateApihttpLocalhost8000ProjectIdSamplersSamplerIdDomainsAddAllArgs = {project_id: string, sampler_id: string, body: {domains: string}}; export type CreateApihttpLocalhost8000ProjectIdSamplersSamplerIdDomainsAddAllOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new domain for a sampler. * * POST http://localhost:8000/{project_id}/samplers/{sampler_id}/domains/add-all */ export const createApihttpLocalhost8000ProjectIdSamplersSamplerIdDomainsAddAll = async (args: CreateApihttpLocalhost8000ProjectIdSamplersSamplerIdDomainsAddAllArgs, options?: CreateApihttpLocalhost8000ProjectIdSamplersSamplerIdDomainsAddAllOptions) => { const {baseUrl = "http://localhost:8000", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") const url = `${baseUrl.replace(/\/+$/, '')}http://localhost:8000/${encodeURIComponent(String(args.project_id))}/samplers/${encodeURIComponent(String(args.sampler_id))}/domains/add-all${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };