export type PatchApiCatalogBundlesBundleIdItemsItemIdArgs = {bundle_id: number, item_id: string, body: {entity_id?: number | undefined, quantity?: string | undefined, price?: string | undefined, warranty?: ({period: string, unit: 'days' | 'months'}) | undefined, discount?: ({type: 'percentage' | 'value', percentage: number, amount: string, sponsor: 'staff' | 'company'}) | undefined}}; export type PatchApiCatalogBundlesBundleIdItemsItemIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Bundle Item * * PATCH /catalog/bundles/{bundle_id}/items/{item_id} */ export const patchApiCatalogBundlesBundleIdItemsItemId = async (args: PatchApiCatalogBundlesBundleIdItemsItemIdArgs, options?: PatchApiCatalogBundlesBundleIdItemsItemIdOptions) => { 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))}/items/${encodeURIComponent(String(args.item_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 };