export type DeleteApiApiLocationsLocationIdArgs = {location_id: number, entity_type?: string | undefined, entity_id?: number | undefined}; export type DeleteApiApiLocationsLocationIdOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a location * * DELETE /api/locations/{location_id} */ export const deleteApiApiLocationsLocationId = async (args: DeleteApiApiLocationsLocationIdArgs, options: DeleteApiApiLocationsLocationIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.entity_type != null) query.append("entity_type", String(args.entity_type)) if (args.entity_id != null) query.append("entity_id", String(args.entity_id)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/locations/${encodeURIComponent(String(args.location_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };