export type CurrencyWrite = 'EUR' | 'AUD' | 'GBP' | 'BGN' | 'CAD' | 'CZK' | 'DKK' | 'HUF' | 'ILS' | 'LVL' | 'LTL' | 'MXN' | 'NZD' | 'NOK' | 'PLN' | 'RON' | 'RUB' | 'ZAR' | 'SEK' | 'CHF' | 'AED' | 'USD'; export type UpdateStockDetailsModel = {productCategoryId?: number | undefined, model?: string | undefined, make?: (string | null) | undefined, sellingPrice?: (number | null) | undefined, currencyCode?: CurrencyWrite | undefined, departmentCodeId?: (number | null) | undefined, nominalCodeId?: (number | null) | undefined, notes?: (string | null) | undefined, modelNumber?: (string | null) | undefined, stockCode?: (string | null) | undefined, batchNumber?: (string | null) | undefined, size?: (number | null) | undefined, weight?: (number | null) | undefined, taxId?: (number | null) | undefined}; export type PatchApiV1StockDetailsStockDetailsIdArgs = {'Customer-Id': number, stockDetailsId: number, body: UpdateStockDetailsModel}; export type PatchApiV1StockDetailsStockDetailsIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a stock details * * PATCH /v1/stockDetails/{stockDetailsId} */ export const patchApiV1StockDetailsStockDetailsId = async (args: PatchApiV1StockDetailsStockDetailsIdArgs, options?: PatchApiV1StockDetailsStockDetailsIdOptions) => { const {baseUrl = "https://api.bigchange.com", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Customer-Id'] != null) headers.set("Customer-Id", String(args['Customer-Id'])) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/stockDetails/${encodeURIComponent(String(args.stockDetailsId))}${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 };