export type DeleteApiRegionsCountryIdArgs = {country: string, id: string, Authorization: string}; export type DeleteApiRegionsCountryIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a specific region of a given country * * DELETE /regions/{country}/{id} */ export const deleteApiRegionsCountryId = async (args: DeleteApiRegionsCountryIdArgs, options?: DeleteApiRegionsCountryIdOptions) => { const {baseUrl = "http://127.0.0.1:8443", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/regions/${encodeURIComponent(String(args.country))}/${encodeURIComponent(String(args.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 };