export type WeightType = 0 | 1; export type BinItem = {barcode?: (string | null) | undefined, weight?: number | undefined, unit?: (string | null) | undefined, weightType?: WeightType | undefined, quantity?: number | undefined, itemCode?: (string | null) | undefined, itemName?: (string | null) | undefined, isWeightAdjusted?: boolean | undefined}; export type CabinetLocationItemsParam = {id?: number | undefined, barcode?: (string | null) | undefined, weight?: (number | null) | undefined, unit?: (string | null) | undefined, weightType?: WeightType | undefined, quantity?: number | undefined, itemCode?: (string | null) | undefined, itemName?: (string | null) | undefined, isWeightAdjusted?: boolean | undefined, bufferLevel?: (number | null) | undefined, minOrderQty?: (number | null) | undefined}; export type Bin = {index?: number | undefined, code?: (string | null) | undefined, items?: (Array | null) | undefined, itemParam?: CabinetLocationItemsParam | undefined}; export type Shelf = {index?: number | undefined, bins?: (Array | null) | undefined, code?: (string | null) | undefined, slot?: number | undefined}; export type ShelfBinValueTuple = Record; export type Compartment = {index?: number | undefined, shelves?: (Array | null) | undefined, bins?: (Array | null) | undefined}; export type CreateScaleLockerConfigRequest = {compartments?: (Array | null) | undefined}; export type UpdateApiV1ScaleLockerLocationIdLockerIdArgs = {locationId: number, lockerId: string, Account: unknown, body: CreateScaleLockerConfigRequest}; export type UpdateApiV1ScaleLockerLocationIdLockerIdOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Save Scale locker layout/configuration * * PUT /v1/ScaleLocker/{locationId}/{lockerId} */ export const updateApiV1ScaleLockerLocationIdLockerId = async (args: UpdateApiV1ScaleLockerLocationIdLockerIdArgs, options: UpdateApiV1ScaleLockerLocationIdLockerIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json-patch+json; x-api-version=1.0") if (args.Account != null) query.append("Account", String(args.Account)) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/ScaleLocker/${encodeURIComponent(String(args.locationId))}/${encodeURIComponent(String(args.lockerId))}${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 };