export type CreateApiWorkLocationsPublicApiImportsUserLocationsArgs = {'Content-Type': string, create: boolean, overrideUserLocations: boolean, body: BodyInit}; export type CreateApiWorkLocationsPublicApiImportsUserLocationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Import user locations * * POST /work-locations/public/api/imports/user-locations */ export const createApiWorkLocationsPublicApiImportsUserLocations = async (args: CreateApiWorkLocationsPublicApiImportsUserLocationsArgs, options?: CreateApiWorkLocationsPublicApiImportsUserLocationsOptions) => { const {baseUrl = "https://example.ilucca.net", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (args.create != null) query.append("create", String(args.create)) if (args.overrideUserLocations != null) query.append("overrideUserLocations", String(args.overrideUserLocations)) const url = `${baseUrl.replace(/\/+$/, '')}/work-locations/public/api/imports/user-locations${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };