/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetStatementGlobals = { /** * Specify an API version. * * @remarks * * API versioning follows the format `vYYYY.QQ.BB`, where * - `YYYY` is the year * - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10) * - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter. * - For example, `v2024.01.00` is the initial release of the first quarter of 2024. * * The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release. * When no version is specified, the API defaults to `v2024.01.00`. */ xMoovVersion?: string | undefined; }; export type GetStatementRequest = { accountID: string; statementID: string; }; export type GetStatementResponseResult = | components.Statement | ReadableStream; export type GetStatementResponse = { headers: { [k: string]: Array }; result: components.Statement | ReadableStream; }; /** @internal */ export const GetStatementGlobals$inboundSchema: z.ZodType< GetStatementGlobals, z.ZodTypeDef, unknown > = z.object({ "X-Moov-Version": z.string().optional(), }).transform((v) => { return remap$(v, { "X-Moov-Version": "xMoovVersion", }); }); /** @internal */ export type GetStatementGlobals$Outbound = { "X-Moov-Version"?: string | undefined; }; /** @internal */ export const GetStatementGlobals$outboundSchema: z.ZodType< GetStatementGlobals$Outbound, z.ZodTypeDef, GetStatementGlobals > = z.object({ xMoovVersion: z.string().optional(), }).transform((v) => { return remap$(v, { xMoovVersion: "X-Moov-Version", }); }); export function getStatementGlobalsToJSON( getStatementGlobals: GetStatementGlobals, ): string { return JSON.stringify( GetStatementGlobals$outboundSchema.parse(getStatementGlobals), ); } export function getStatementGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetStatementGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStatementGlobals' from JSON`, ); } /** @internal */ export const GetStatementRequest$inboundSchema: z.ZodType< GetStatementRequest, z.ZodTypeDef, unknown > = z.object({ accountID: z.string(), statementID: z.string(), }); /** @internal */ export type GetStatementRequest$Outbound = { accountID: string; statementID: string; }; /** @internal */ export const GetStatementRequest$outboundSchema: z.ZodType< GetStatementRequest$Outbound, z.ZodTypeDef, GetStatementRequest > = z.object({ accountID: z.string(), statementID: z.string(), }); export function getStatementRequestToJSON( getStatementRequest: GetStatementRequest, ): string { return JSON.stringify( GetStatementRequest$outboundSchema.parse(getStatementRequest), ); } export function getStatementRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetStatementRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStatementRequest' from JSON`, ); } /** @internal */ export const GetStatementResponseResult$inboundSchema: z.ZodType< GetStatementResponseResult, z.ZodTypeDef, unknown > = z.union([ components.Statement$inboundSchema, z.instanceof(ReadableStream), ]); /** @internal */ export type GetStatementResponseResult$Outbound = | components.Statement$Outbound | ReadableStream; /** @internal */ export const GetStatementResponseResult$outboundSchema: z.ZodType< GetStatementResponseResult$Outbound, z.ZodTypeDef, GetStatementResponseResult > = z.union([ components.Statement$outboundSchema, z.instanceof(ReadableStream), ]); export function getStatementResponseResultToJSON( getStatementResponseResult: GetStatementResponseResult, ): string { return JSON.stringify( GetStatementResponseResult$outboundSchema.parse(getStatementResponseResult), ); } export function getStatementResponseResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetStatementResponseResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStatementResponseResult' from JSON`, ); } /** @internal */ export const GetStatementResponse$inboundSchema: z.ZodType< GetStatementResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: z.union([ components.Statement$inboundSchema, z.instanceof(ReadableStream), ]), }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); /** @internal */ export type GetStatementResponse$Outbound = { Headers: { [k: string]: Array }; Result: components.Statement$Outbound | ReadableStream; }; /** @internal */ export const GetStatementResponse$outboundSchema: z.ZodType< GetStatementResponse$Outbound, z.ZodTypeDef, GetStatementResponse > = z.object({ headers: z.record(z.array(z.string())), result: z.union([ components.Statement$outboundSchema, z.instanceof(ReadableStream), ]), }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function getStatementResponseToJSON( getStatementResponse: GetStatementResponse, ): string { return JSON.stringify( GetStatementResponse$outboundSchema.parse(getStatementResponse), ); } export function getStatementResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetStatementResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStatementResponse' from JSON`, ); }