import {z} from 'zod' export type CreateApiClaimmanagerRejectitemsTypedIdArgs = {body: {data?: ({items?: Array | undefined}) | undefined}}; export type CreateApiClaimmanagerRejectitemsTypedIdOptions = {baseUrl?: string | undefined, basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; export const claimLineItem = z.object({typedId: z.string().optional(), attribute83: z.string().max(70).nullable().optional(), attribute82: z.string().max(70).nullable().optional(), attribute81: z.string().max(70).nullable().optional(), attribute80: z.string().max(70).nullable().optional(), attribute89: z.string().max(70).nullable().optional(), attribute88: z.string().max(70).nullable().optional(), sku: z.string().max(255).optional(), attribute87: z.string().max(70).nullable().optional(), attribute86: z.string().max(70).nullable().optional(), attribute85: z.string().max(70).nullable().optional(), attribute84: z.string().max(70).nullable().optional(), version: z.number().int().optional(), attribute9: z.string().max(70).nullable().optional(), attribute94: z.string().max(70).nullable().optional(), attribute8: z.string().max(70).nullable().optional(), attribute93: z.string().max(70).nullable().optional(), attribute92: z.string().max(70).nullable().optional(), attribute91: z.string().max(70).nullable().optional(), attribute5: z.string().max(70).nullable().optional(), attribute90: z.string().max(70).nullable().optional(), attribute4: z.string().max(70).nullable().optional(), attribute7: z.string().max(70).nullable().optional(), attribute6: z.string().max(70).nullable().optional(), attribute1: z.string().max(70).nullable().optional(), attribute14: z.string().max(70).nullable().optional(), attribute13: z.string().max(70).nullable().optional(), attribute3: z.string().max(70).nullable().optional(), attribute12: z.string().max(70).nullable().optional(), endCustomerId: z.string().max(255).optional(), attribute2: z.string().max(70).nullable().optional(), attribute11: z.string().max(70).nullable().optional(), attribute99: z.string().max(70).nullable().optional(), attribute10: z.string().max(70).nullable().optional(), attribute98: z.string().max(70).nullable().optional(), attribute97: z.string().max(70).nullable().optional(), attribute96: z.string().max(70).nullable().optional(), attribute95: z.string().max(70).nullable().optional(), attribute19: z.string().max(70).nullable().optional(), attribute18: z.string().max(70).nullable().optional(), attribute17: z.string().max(70).nullable().optional(), attribute16: z.string().max(70).nullable().optional(), attribute15: z.string().max(70).nullable().optional(), attribute25: z.string().max(70).nullable().optional(), attribute24: z.string().max(70).nullable().optional(), attribute23: z.string().max(70).nullable().optional(), attribute22: z.string().max(70).nullable().optional(), attribute21: z.string().max(70).nullable().optional(), attribute20: z.string().max(70).nullable().optional(), createDate: z.string().optional(), attribute29: z.string().max(70).nullable().optional(), attribute28: z.string().max(70).nullable().optional(), attribute27: z.string().max(70).nullable().optional(), attribute26: z.string().max(70).nullable().optional(), attribute36: z.string().max(70).nullable().optional(), quoteUniqueName: z.string().max(255).optional(), attribute35: z.string().max(70).nullable().optional(), attribute34: z.string().max(70).nullable().optional(), attribute33: z.string().max(70).nullable().optional(), attribute32: z.string().max(70).nullable().optional(), attribute31: z.string().max(70).nullable().optional(), attribute30: z.string().max(70).nullable().optional(), attribute39: z.string().max(70).nullable().optional(), lastUpdateDate: z.string().optional(), attribute38: z.string().max(70).nullable().optional(), attribute37: z.string().max(70).nullable().optional(), attribute47: z.string().max(70).nullable().optional(), attribute46: z.string().max(70).nullable().optional(), attribute45: z.string().max(70).nullable().optional(), attribute44: z.string().max(70).nullable().optional(), attribute43: z.string().max(70).nullable().optional(), attribute42: z.string().max(70).nullable().optional(), attribute41: z.string().max(70).nullable().optional(), attribute40: z.string().max(70).nullable().optional(), attribute49: z.string().max(70).nullable().optional(), contractUniqueName: z.string().max(255).optional(), attribute48: z.string().max(70).nullable().optional(), attribute50: z.string().max(70).nullable().optional(), totalAmount: z.number().optional(), attribute100: z.string().max(70).nullable().optional(), attribute58: z.string().max(70).nullable().optional(), attribute57: z.string().max(70).nullable().optional(), attribute56: z.string().max(70).nullable().optional(), attribute55: z.string().max(70).nullable().optional(), attribute54: z.string().max(70).nullable().optional(), attribute53: z.string().max(70).nullable().optional(), attribute52: z.string().max(70).nullable().optional(), validationState: z.enum(["NOT_VALIDATED", "AUTO_VALIDATED", "AUTO_REJECTED", "VALIDATED", "REJECTED"]).max(255).optional(), attribute51: z.string().max(70).nullable().optional(), attribute59: z.string().max(70).nullable().optional(), attribute61: z.string().max(70).nullable().optional(), attribute60: z.string().max(70).nullable().optional(), attribute69: z.string().max(70).nullable().optional(), attribute68: z.string().max(70).nullable().optional(), attribute67: z.string().max(70).nullable().optional(), attribute66: z.string().max(70).nullable().optional(), attribute65: z.string().max(70).nullable().optional(), attribute64: z.string().max(70).nullable().optional(), attribute63: z.string().max(70).nullable().optional(), attribute62: z.string().max(70).nullable().optional(), quantity: z.number().optional(), attribute72: z.string().max(70).nullable().optional(), attribute71: z.string().max(70).nullable().optional(), attribute70: z.string().max(70).nullable().optional(), createdBy: z.number().int().optional(), calculationStatus: z.number().int().optional(), attribute79: z.string().max(70).nullable().optional(), attribute78: z.string().max(70).nullable().optional(), attribute77: z.string().max(70).nullable().optional(), attribute76: z.string().max(70).nullable().optional(), attribute75: z.string().max(70).nullable().optional(), attribute74: z.string().max(70).nullable().optional(), lastUpdateBy: z.number().int().optional(), attribute73: z.string().max(70).nullable().optional()}); export const createApiClaimmanagerRejectitemsTypedIdResponse = z.object({response: z.object({node: z.string().optional(), data: z.array(claimLineItem).optional(), status: z.number().int().optional()}).optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Reject Items * * POST /claimmanager.rejectitems/{typedId} * * Also accepts auth: X-PriceFx-jwt */ export const createApiClaimmanagerRejectitemsTypedId = async (args: CreateApiClaimmanagerRejectitemsTypedIdArgs, options?: CreateApiClaimmanagerRejectitemsTypedIdOptions) => { const {baseUrl = "https://companynode.pricefx.com/pricefx/companypartition", fetch: fetchFn = fetch, basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (basic !== undefined) headers.set('authorization', `Basic ${btoa(`${basic.username}:${basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/claimmanager.rejectitems/${encodeURIComponent(String(args.typedId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 validateResponse(createApiClaimmanagerRejectitemsTypedIdResponse, await res.json()) };