export type GetApiApiCollectionItemsIdArgs = {id: string, collection_id: string, user_id: string}; export type GetApiApiCollectionItemsIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Retrieve a collection item by id. * * GET /api/collection_items/{id} */ export const getApiApiCollectionItemsId = async (args: GetApiApiCollectionItemsIdArgs, options: GetApiApiCollectionItemsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.collection_id != null) query.append("collection_id", String(args.collection_id)) if (args.user_id != null) query.append("user_id", String(args.user_id)) const url = `${baseUrl.replace(/\/+$/, '')}/api/collection_items/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };