export type UpdateApiV1CollectionsCollectionIdRestoreArgs = {'App-ID': string, 'Auth-Token': string, collection_id: string}; export type UpdateApiV1CollectionsCollectionIdRestoreOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Restore deleted collection by id * * PUT /v1/collections/{collection_id}/restore/ */ export const updateApiV1CollectionsCollectionIdRestore = async (args: UpdateApiV1CollectionsCollectionIdRestoreArgs, options: UpdateApiV1CollectionsCollectionIdRestoreOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/collections/${encodeURIComponent(String(args.collection_id))}/restore/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };