/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
/**
* Result contains the result of the `/call` invocation. This result will not be inspected or interpreted by Rosetta tooling and is left to the caller to decode.
*/
export type Result = {};
/**
* CallResponse contains the result of a `/call` invocation.
*/
export type CallResponse = {
/**
* Result contains the result of the `/call` invocation. This result will not be inspected or interpreted by Rosetta tooling and is left to the caller to decode.
*/
result: Result;
/**
* Idempotent indicates that if `/call` is invoked with the same CallRequest again, at any point in time, it will return the same CallResponse. Integrators may cache the CallResponse if this is set to true to avoid making unnecessary calls to the Rosetta implementation. For this reason, implementers should be very conservative about returning true here or they could cause issues for the caller.
*/
idempotent: boolean;
};
/** @internal */
export const Result$inboundSchema: z.ZodType<Result, z.ZodTypeDef, unknown> = z
.object({});
/** @internal */
export type Result$Outbound = {};
/** @internal */
export const Result$outboundSchema: z.ZodType<
Result$Outbound,
z.ZodTypeDef,
Result
> = z.object({});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace Result$ {
/** @deprecated use `Result$inboundSchema` instead. */
export const inboundSchema = Result$inboundSchema;
/** @deprecated use `Result$outboundSchema` instead. */
export const outboundSchema = Result$outboundSchema;
/** @deprecated use `Result$Outbound` instead. */
export type Outbound = Result$Outbound;
}
export function resultToJSON(result: Result): string {
return JSON.stringify(Result$outboundSchema.parse(result));
}
export function resultFromJSON(
jsonString: string,
): SafeParseResult<Result, SDKValidationError> {
return safeParse(
jsonString,
(x) => Result$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Result' from JSON`,
);
}
/** @internal */
export const CallResponse$inboundSchema: z.ZodType<
CallResponse,
z.ZodTypeDef,
unknown
> = z.object({
result: z.lazy(() => Result$inboundSchema),
idempotent: z.boolean(),
});
/** @internal */
export type CallResponse$Outbound = {
result: Result$Outbound;
idempotent: boolean;
};
/** @internal */
export const CallResponse$outboundSchema: z.ZodType<
CallResponse$Outbound,
z.ZodTypeDef,
CallResponse
> = z.object({
result: z.lazy(() => Result$outboundSchema),
idempotent: z.boolean(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace CallResponse$ {
/** @deprecated use `CallResponse$inboundSchema` instead. */
export const inboundSchema = CallResponse$inboundSchema;
/** @deprecated use `CallResponse$outboundSchema` instead. */
export const outboundSchema = CallResponse$outboundSchema;
/** @deprecated use `CallResponse$Outbound` instead. */
export type Outbound = CallResponse$Outbound;
}
export function callResponseToJSON(callResponse: CallResponse): string {
return JSON.stringify(CallResponse$outboundSchema.parse(callResponse));
}
export function callResponseFromJSON(
jsonString: string,
): SafeParseResult<CallResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => CallResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CallResponse' from JSON`,
);
}