/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./errors/sdk-validation-error.js"; import { FeedbackRecord, FeedbackRecord$inboundSchema, } from "./feedback-record.js"; import { FeedbackTarget, FeedbackTarget$inboundSchema, } from "./feedback-target.js"; export type Ratings = { one: number; two: number; three: number; four: number; five: number; }; export type Verification = { anonymous: number; walletHeader: number; composeKey: number; }; export type FeedbackSummary = { target: FeedbackTarget; count: number; ratingCount: number; ratingAverage: number | null; ratings: Ratings; categories: { [k: string]: number }; verification: Verification; recent: Array; }; /** @internal */ export const Ratings$inboundSchema: z.ZodMiniType = z.pipe( z.object({ "1": types.number(), "2": types.number(), "3": types.number(), "4": types.number(), "5": types.number(), }), z.transform((v) => { return remap$(v, { "1": "one", "2": "two", "3": "three", "4": "four", "5": "five", }); }), ); export function ratingsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Ratings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Ratings' from JSON`, ); } /** @internal */ export const Verification$inboundSchema: z.ZodMiniType = z.pipe( z.object({ anonymous: types.number(), wallet_header: types.number(), compose_key: types.number(), }), z.transform((v) => { return remap$(v, { "wallet_header": "walletHeader", "compose_key": "composeKey", }); }), ); export function verificationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Verification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Verification' from JSON`, ); } /** @internal */ export const FeedbackSummary$inboundSchema: z.ZodMiniType< FeedbackSummary, unknown > = z.object({ target: FeedbackTarget$inboundSchema, count: types.number(), ratingCount: types.number(), ratingAverage: types.nullable(types.number()), ratings: z.lazy(() => Ratings$inboundSchema), categories: z.record(z.string(), types.number()), verification: z.lazy(() => Verification$inboundSchema), recent: z.array(FeedbackRecord$inboundSchema), }); export function feedbackSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeedbackSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeedbackSummary' from JSON`, ); }