export type PatchApiCatalogBundlesBundleIdArgs = {bundle_id: number, body: {title?: string | undefined, description?: string | undefined, category_id?: number | undefined, barcode?: ({type: 'ean8' | 'ean13' | 'qrcode' | 'code128' | 'upc', code: string}) | undefined}}; export type PatchApiCatalogBundlesBundleIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Bundle * * PATCH /catalog/bundles/{bundle_id} */ export const patchApiCatalogBundlesBundleId = async (args: PatchApiCatalogBundlesBundleIdArgs, options?: PatchApiCatalogBundlesBundleIdOptions) => { const {baseUrl = "https://api.roapp.io/v2", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/catalog/bundles/${encodeURIComponent(String(args.bundle_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };