export type PatchApiV3CollectionsUidArgs = {body: BodyInit}; export type PatchApiV3CollectionsUidOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a collection * * PATCH /v3/collections/{uid} */ export const patchApiV3CollectionsUid = async (args: PatchApiV3CollectionsUidArgs, options?: PatchApiV3CollectionsUidOptions) => { const {baseUrl = "https://api.sketchfab.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v3/collections/${encodeURIComponent(String(args.uid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };