export type LocationJoin = {tag?: (string | null) | undefined, title?: (string | null) | undefined, notes?: (string | null) | undefined, created_at?: string | undefined, id?: number | undefined, location: number, object_id?: (number | null) | undefined}; export type CreateApiIncidentsIdLocationsArgs = {body: LocationJoin}; export type CreateApiIncidentsIdLocationsOptions = {baseUrl?: string | undefined, Token?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add location * * POST /incidents/{id}/locations */ export const createApiIncidentsIdLocations = async (args: CreateApiIncidentsIdLocationsArgs, options?: CreateApiIncidentsIdLocationsOptions) => { const {baseUrl = "https://crisiscleanup-3-api-production.up.railway.app", fetch: fetchFn = fetch, Token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Token !== undefined) headers.set("Authorization", Token) const url = `${baseUrl.replace(/\/+$/, '')}/incidents/${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 undefined };