/* * 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 { smartUnion } from "../../types/smart-union.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; import * as models from "../index.js"; export type ResponsesCreateSecurity = { keyAuth?: string | undefined; x402Payment?: string | undefined; }; export type ResponsesCreateRequest = { xSessionUserAddress?: string | undefined; xNetworkId?: string | undefined; xX402MaxAmountWei?: string | undefined; xIdempotencyKey?: string | undefined; body: models.ResponsesCreateRequest; }; export type ResponsesCreateResponseResult = models.ResponseObject | string; export type ResponsesCreateResponse = { headers: { [k: string]: Array }; result: models.ResponseObject | string; }; /** @internal */ export type ResponsesCreateSecurity$Outbound = { KeyAuth?: string | undefined; X402Payment?: string | undefined; }; /** @internal */ export const ResponsesCreateSecurity$outboundSchema: z.ZodMiniType< ResponsesCreateSecurity$Outbound, ResponsesCreateSecurity > = z.pipe( z.object({ keyAuth: z.optional(z.string()), x402Payment: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { keyAuth: "KeyAuth", x402Payment: "X402Payment", }); }), ); export function responsesCreateSecurityToJSON( responsesCreateSecurity: ResponsesCreateSecurity, ): string { return JSON.stringify( ResponsesCreateSecurity$outboundSchema.parse(responsesCreateSecurity), ); } /** @internal */ export type ResponsesCreateRequest$Outbound = { "x-session-user-address"?: string | undefined; "x-network-id"?: string | undefined; "x-x402-max-amount-wei"?: string | undefined; "x-idempotency-key"?: string | undefined; body: models.ResponsesCreateRequest$Outbound; }; /** @internal */ export const ResponsesCreateRequest$outboundSchema: z.ZodMiniType< ResponsesCreateRequest$Outbound, ResponsesCreateRequest > = z.pipe( z.object({ xSessionUserAddress: z.optional(z.string()), xNetworkId: z.optional(z.string()), xX402MaxAmountWei: z.optional(z.string()), xIdempotencyKey: z.optional(z.string()), body: models.ResponsesCreateRequest$outboundSchema, }), z.transform((v) => { return remap$(v, { xSessionUserAddress: "x-session-user-address", xNetworkId: "x-network-id", xX402MaxAmountWei: "x-x402-max-amount-wei", xIdempotencyKey: "x-idempotency-key", }); }), ); export function responsesCreateRequestToJSON( responsesCreateRequest: ResponsesCreateRequest, ): string { return JSON.stringify( ResponsesCreateRequest$outboundSchema.parse(responsesCreateRequest), ); } /** @internal */ export const ResponsesCreateResponseResult$inboundSchema: z.ZodMiniType< ResponsesCreateResponseResult, unknown > = smartUnion([models.ResponseObject$inboundSchema, types.string()]); export function responsesCreateResponseResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponsesCreateResponseResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponsesCreateResponseResult' from JSON`, ); } /** @internal */ export const ResponsesCreateResponse$inboundSchema: z.ZodMiniType< ResponsesCreateResponse, unknown > = z.pipe( z.object({ Headers: z._default(z.record(z.string(), z.array(z.string())), {}), Result: smartUnion([models.ResponseObject$inboundSchema, types.string()]), }), z.transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }), ); export function responsesCreateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponsesCreateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponsesCreateResponse' from JSON`, ); }