export type DeleteApiV3CollectionsUidModelsArgs = {models?: Array | undefined}; export type DeleteApiV3CollectionsUidModelsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Removes models from a collection * * DELETE /v3/collections/{uid}/models */ export const deleteApiV3CollectionsUidModels = async (args: DeleteApiV3CollectionsUidModelsArgs, options?: DeleteApiV3CollectionsUidModelsOptions) => { const {baseUrl = "https://api.sketchfab.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.models ?? []) query.append("models", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/v3/collections/${encodeURIComponent(String(args.uid))}/models${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 };