/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; 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"; export type Endpoint = { method?: string | undefined; path?: string | undefined; url?: string | undefined; }; export type Receipt = { network?: string | undefined; txHash?: string | undefined; /** * Non-negative integer amount in USDC atomic units. */ finalAmountWei?: string | undefined; }; export type SDK = { name?: string | undefined; version?: string | undefined; }; export type FeedbackContext = { requestId?: string | undefined; paymentIntentId?: string | undefined; runId?: string | undefined; network?: string | undefined; modelId?: string | undefined; provider?: string | undefined; agentWallet?: string | undefined; workflowWallet?: string | undefined; endpoint?: Endpoint | undefined; receipt?: Receipt | undefined; sdk?: SDK | undefined; }; /** @internal */ export const Endpoint$inboundSchema: z.ZodMiniType = z .object({ method: types.optional(types.string()), path: types.optional(types.string()), url: types.optional(types.string()), }); /** @internal */ export type Endpoint$Outbound = { method?: string | undefined; path?: string | undefined; url?: string | undefined; }; /** @internal */ export const Endpoint$outboundSchema: z.ZodMiniType< Endpoint$Outbound, Endpoint > = z.object({ method: z.optional(z.string()), path: z.optional(z.string()), url: z.optional(z.string()), }); export function endpointToJSON(endpoint: Endpoint): string { return JSON.stringify(Endpoint$outboundSchema.parse(endpoint)); } export function endpointFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Endpoint$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Endpoint' from JSON`, ); } /** @internal */ export const Receipt$inboundSchema: z.ZodMiniType = z.object({ network: types.optional(types.string()), txHash: types.optional(types.string()), finalAmountWei: types.optional(types.string()), }); /** @internal */ export type Receipt$Outbound = { network?: string | undefined; txHash?: string | undefined; finalAmountWei?: string | undefined; }; /** @internal */ export const Receipt$outboundSchema: z.ZodMiniType = z.object({ network: z.optional(z.string()), txHash: z.optional(z.string()), finalAmountWei: z.optional(z.string()), }); export function receiptToJSON(receipt: Receipt): string { return JSON.stringify(Receipt$outboundSchema.parse(receipt)); } export function receiptFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Receipt$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Receipt' from JSON`, ); } /** @internal */ export const SDK$inboundSchema: z.ZodMiniType = z.object({ name: types.optional(types.string()), version: types.optional(types.string()), }); /** @internal */ export type SDK$Outbound = { name?: string | undefined; version?: string | undefined; }; /** @internal */ export const SDK$outboundSchema: z.ZodMiniType = z.object({ name: z.optional(z.string()), version: z.optional(z.string()), }); export function sdkToJSON(sdk: SDK): string { return JSON.stringify(SDK$outboundSchema.parse(sdk)); } export function sdkFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SDK$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SDK' from JSON`, ); } /** @internal */ export const FeedbackContext$inboundSchema: z.ZodMiniType< FeedbackContext, unknown > = z.object({ requestId: types.optional(types.string()), paymentIntentId: types.optional(types.string()), runId: types.optional(types.string()), network: types.optional(types.string()), modelId: types.optional(types.string()), provider: types.optional(types.string()), agentWallet: types.optional(types.string()), workflowWallet: types.optional(types.string()), endpoint: types.optional(z.lazy(() => Endpoint$inboundSchema)), receipt: types.optional(z.lazy(() => Receipt$inboundSchema)), sdk: types.optional(z.lazy(() => SDK$inboundSchema)), }); /** @internal */ export type FeedbackContext$Outbound = { requestId?: string | undefined; paymentIntentId?: string | undefined; runId?: string | undefined; network?: string | undefined; modelId?: string | undefined; provider?: string | undefined; agentWallet?: string | undefined; workflowWallet?: string | undefined; endpoint?: Endpoint$Outbound | undefined; receipt?: Receipt$Outbound | undefined; sdk?: SDK$Outbound | undefined; }; /** @internal */ export const FeedbackContext$outboundSchema: z.ZodMiniType< FeedbackContext$Outbound, FeedbackContext > = z.object({ requestId: z.optional(z.string()), paymentIntentId: z.optional(z.string()), runId: z.optional(z.string()), network: z.optional(z.string()), modelId: z.optional(z.string()), provider: z.optional(z.string()), agentWallet: z.optional(z.string()), workflowWallet: z.optional(z.string()), endpoint: z.optional(z.lazy(() => Endpoint$outboundSchema)), receipt: z.optional(z.lazy(() => Receipt$outboundSchema)), sdk: z.optional(z.lazy(() => SDK$outboundSchema)), }); export function feedbackContextToJSON( feedbackContext: FeedbackContext, ): string { return JSON.stringify(FeedbackContext$outboundSchema.parse(feedbackContext)); } export function feedbackContextFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeedbackContext$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeedbackContext' from JSON`, ); }