export type FilterLinks = {version?: ({href?: string | undefined, id?: string | undefined}) | undefined, dimensions?: ({href?: string | undefined}) | undefined, self?: ({href?: string | undefined}) | undefined}; export type UpdateFilterRequest = {filter_id?: string | undefined, links?: FilterLinks | undefined, dataset?: ({version?: number | undefined}) | undefined}; export type UpdateApiFiltersIdArgs = {submitted?: boolean | undefined, 'If-Match': string, body: UpdateFilterRequest}; export type UpdateApiFiltersIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update a filter * * PUT /filters/{id} */ export const updateApiFiltersId = async (args: UpdateApiFiltersIdArgs, options: UpdateApiFiltersIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.submitted != null) query.append("submitted", String(args.submitted)) if (args['If-Match'] != null) headers.set("If-Match", String(args['If-Match'])) const url = `${baseUrl.replace(/\/+$/, '')}/filters/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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() };