export type GetApiCollectionsCollectionIdItemsItemIdArgs = {collectionId: string, itemId: string}; export type GetApiCollectionsCollectionIdItemsItemIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Return item {itemId} from collection {collectionId} * * GET /collections/{collectionId}/items/{itemId} */ export const getApiCollectionsCollectionIdItemsItemId = async (args: GetApiCollectionsCollectionIdItemsItemIdArgs, options?: GetApiCollectionsCollectionIdItemsItemIdOptions) => { const {baseUrl = "http://localhost:8484/root", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/collections/${encodeURIComponent(String(args.collectionId))}/items/${encodeURIComponent(String(args.itemId))}${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 (await res.json()) as unknown };