export type PatchApiApiV2ProductsIdArgs = {id: string, body: {name?: string | undefined, number?: string | undefined, project?: {id: string} | undefined, description?: (string | null) | undefined, internalComment?: (string | null) | undefined, shortDescription?: (string | null) | undefined, customsTariffNumber?: (string | null) | undefined, ean?: (string | null) | undefined, minimumOrderQuantity?: number | undefined, minimumStorageQuantity?: number | undefined, allowPurchaseFromAllSuppliers?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, hasBatches?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, serialNumbersMode?: ('disabled' | 'user' | 'product' | 'productAndWarehouse') | undefined, hasBestBeforeDate?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, hasBillOfMaterials?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, isAssembledJustInTime?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, isProductionProduct?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, isExternallyProduced?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, isDisabled?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, disabledReason?: (string | null) | undefined, hidePriceOnDocuments?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, ageRating?: ('' | '16' | '18' | null) | undefined, countryOfOrigin?: (string | null) | undefined, regionOfOrigin?: ('' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '99' | null) | undefined, unit?: (string | null) | undefined, measurements?: ({width?: {value: number, unit: 'cm'} | undefined, height?: {value: number, unit: 'cm'} | undefined, length?: {value: number, unit: 'cm'} | undefined, weight?: {value: number, unit: 'kg'} | undefined, netWeight?: {value: number, unit: 'kg'} | undefined}) | undefined, manufacturer?: ({name?: (string | null) | undefined, number?: (string | null) | undefined, link?: (string | null) | undefined}) | undefined, isStockItem?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, isStockTakingDisabled?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, hideJustInTimeItemsOnDocuments?: (boolean | number | 'true' | 'false' | 'True' | 'False' | 'TRUE' | 'FALSE') | undefined, salesTax?: ('standard' | 'reduced' | 'free') | undefined, isShippingCostsProduct?: boolean | undefined, isMatrixProduct?: boolean | undefined, discount?: ({isDiscountProduct?: boolean | undefined, discountPercentage?: number | undefined}) | undefined, stockTaking?: ({hasStockTakingValue?: boolean | undefined, stockTakingValue?: number | undefined}) | undefined, calculatedPurchasePrice?: ({hasCalculatedPurchasePrice?: boolean | undefined, price?: ({amount?: unknown | undefined, currency?: ('EUR' | 'USD' | 'JPY' | 'BGN' | 'CZK' | 'DKK' | 'GBP' | 'HUF' | 'PLN' | 'RON' | 'SEK' | 'CHF' | 'ISK' | 'NOK' | 'HRK' | 'RUB' | 'TRY' | 'AUD' | 'BRL' | 'CAD' | 'CNY' | 'HKD' | 'IDR' | 'ILS' | 'INR' | 'KRW' | 'MXN' | 'MYR' | 'NZD' | 'PHP' | 'SGD' | 'THB' | 'ZAR' | 'ARS' | 'CLP' | 'SAR' | 'AED' | 'QAR') | undefined}) | undefined}) | undefined, calculatoryPurchasePriceSettings?: ({addPurchasePriceToCalculationTriggers?: (Array<'onPurchaseOrderCompletion' | 'onGoodsReceipt'> | null) | undefined, calculatoryPurchasePriceRecalculationTriggers?: (Array<'onPurchaseOrderCompletion' | 'onGoodsReceipt'> | null) | undefined, calculatoryPurchasePriceRecalculationMethod?: ('allRecordedPurchasesWeightedAverage' | 'latestPurchaseOrdersWeightedAverage' | 'movingAverage' | null) | undefined}) | undefined, salesChannel?: ({description?: string | undefined, meta?: ({title?: string | undefined, description?: string | undefined, keywords?: string | undefined}) | undefined, isStockNumberSyncActive?: boolean | undefined, isSoldOut?: boolean | undefined, isRemainingQuantity?: boolean | undefined, isVisible?: boolean | undefined, suggestedRetailPrice?: (unknown | null) | undefined, suggestedStockQuantity?: string | undefined, deliveryTime?: string | undefined, createNewProductDuringImport?: boolean | undefined}) | undefined, merchandiseGroup?: {id: string} | undefined, defaultStorageLocation?: ({id: string} | null) | undefined, categories?: Array<{id: string}> | undefined, standardSupplier?: ({id: string | null} | null) | undefined, freeFields?: (Array<{id: string, value: string}> | null) | undefined, options?: (Array<{id?: string | undefined, name?: string | undefined, values?: (Array<{id?: string | undefined, name?: string | undefined, sort?: (number | null) | undefined}> | null) | undefined}> | null) | undefined, selectedOptions?: (Array<{id?: string | undefined, option?: ({id?: string | undefined}) | undefined}>) | undefined, tags?: (Array<{id?: string | undefined, key?: string | undefined, name?: string | undefined, color?: string | undefined}>) | undefined, variantOf?: ({id: string} | null) | undefined}}; export type PatchApiApiV2ProductsIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update product v2 * * PATCH /api/v2/products/{id} */ export const patchApiApiV2ProductsId = async (args: PatchApiApiV2ProductsIdArgs, options?: PatchApiApiV2ProductsIdOptions) => { const {baseUrl = "https://xentral.xentral.biz", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/products/${encodeURIComponent(String(args.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 };