export type ListOfId4ns = {id4ns?: Array | undefined}; export type DeleteApiApiV1CollectionsId4nElementsArgs = {id4n: string, body: ListOfId4ns}; export type DeleteApiApiV1CollectionsId4nElementsOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove elements from collection * * DELETE /api/v1/collections/{id4n}/elements */ export const deleteApiApiV1CollectionsId4nElements = async (args: DeleteApiApiV1CollectionsId4nElementsArgs, options: DeleteApiApiV1CollectionsId4nElementsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/collections/${encodeURIComponent(String(args.id4n))}/elements${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };