export type PatchApiApiV1StorageLocationsSetTotalStockArgs = {body: {data?: (Array<{storageLocation?: ({id?: string | undefined}) | undefined, totalStock?: (Array<{product?: ({id?: string | undefined}) | undefined, quantity?: number | undefined, qualityControlAttributes?: ({batch?: string | undefined, bestBeforeDate?: string | undefined, serialNumbers?: Array<{number: string}> | undefined}) | undefined}>) | undefined}>) | undefined}}; export type PatchApiApiV1StorageLocationsSetTotalStockOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set total stock on storage locations * * PATCH /api/v1/storageLocations/setTotalStock */ export const patchApiApiV1StorageLocationsSetTotalStock = async (args: PatchApiApiV1StorageLocationsSetTotalStockArgs, options?: PatchApiApiV1StorageLocationsSetTotalStockOptions) => { 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/v1/storageLocations/setTotalStock${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 };