export type UpdateApiCatalogProductsIdArgs = {id: number, body: {sku?: string | undefined, name?: string | undefined, product_number?: string | undefined, url_key?: string | undefined, status?: (0 | 1) | undefined, visible_individually?: (0 | 1) | undefined, guest_checkout?: (0 | 1) | undefined, new?: (0 | 1) | undefined, featured?: (0 | 1) | undefined, manage_stock?: (0 | 1) | undefined, price?: string | undefined, cost?: string | undefined, special_price?: string | undefined, special_price_from?: string | undefined, special_price_to?: string | undefined, GST?: string | undefined, weight?: string | undefined, length?: string | undefined, width?: string | undefined, height?: string | undefined, tax_category_id?: number | undefined, color?: number | undefined, size?: number | undefined, brand?: number | undefined, short_description?: string | undefined, description?: string | undefined, meta_title?: string | undefined, meta_keywords?: string | undefined, meta_description?: string | undefined, categories?: Array | undefined, channels?: Array | undefined, up_sells?: Array | undefined, cross_sells?: Array | undefined, related_products?: Array | undefined, customizable_options?: Record | undefined, super_attributes?: Record | undefined, variants?: Record | undefined, bundle_options?: Record | undefined, links?: Record | undefined, downloadable_links?: Record | undefined, downloadable_samples?: Record | undefined, booking?: Record | undefined, translations?: Record | undefined}}; export type UpdateApiCatalogProductsIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a catalog product (any type) * * PUT /catalog/products/{id} */ export const updateApiCatalogProductsId = async (args: UpdateApiCatalogProductsIdArgs, options?: UpdateApiCatalogProductsIdOptions) => { const {baseUrl = "http://localhost:8000/api/admin", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/catalog/products/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 (await res.json()) as unknown };