export type Archivo = {height?: number | undefined, timestamp?: string | undefined, uri?: (string | null) | undefined, fileName?: (string | null) | undefined, data?: (string | null) | undefined}; export type ProductImageRequest = {main?: boolean | undefined, photo?: Archivo | undefined}; export type ProductCreateUpdate = {productID?: (number | null) | undefined, brandID?: (number | null) | undefined, productCategoryID?: (number | null) | undefined, productTypeID?: (number | null) | undefined, gamaProductoID?: (number | null) | undefined, price?: (number | null) | undefined, isActive?: boolean | undefined, name?: (string | null) | undefined, model?: (string | null) | undefined, modelSKU?: (string | null) | undefined, year?: number | undefined, productImages?: (Array | null) | undefined}; export type UpdateApiV1ApiProductsIdArgs = {id: number, body: ProductCreateUpdate}; export type UpdateApiV1ApiProductsIdOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /v1/api/Products/{id} */ export const updateApiV1ApiProductsId = async (args: UpdateApiV1ApiProductsIdArgs, options: UpdateApiV1ApiProductsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/v1/api/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 undefined };