export type CreateApiPublicV1CompaniesIdLocationsArgs = {id: string, body: {id?: string | undefined, name?: string | undefined, street_address?: string | undefined, apt?: string | undefined, city?: string | undefined, state?: string | undefined, zip?: string | undefined, country?: string | undefined, license_id?: string | undefined}}; export type CreateApiPublicV1CompaniesIdLocationsOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upsert a company's location * * POST /public/v1/companies/{id}/locations */ export const createApiPublicV1CompaniesIdLocations = async (args: CreateApiPublicV1CompaniesIdLocationsArgs, options?: CreateApiPublicV1CompaniesIdLocationsOptions) => { const {baseUrl = "https://app.distru.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/companies/${encodeURIComponent(String(args.id))}/locations${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };