/* * 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 ListStatementsGlobals = { /** * 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 ListStatementsRequest = { /** * Optional date-time which inclusively filters all statements where billing period is on or after this date-time. */ billingPeriodStartDateTime?: Date | undefined; /** * Optional date-time which exclusively filters all statements where billing period is before this date-time. */ billingPeriodEndDateTime?: Date | undefined; skip?: number | undefined; count?: number | undefined; accountID: string; }; export type ListStatementsResponse = { headers: { [k: string]: Array }; result: Array; }; /** @internal */ export const ListStatementsGlobals$inboundSchema: z.ZodType< ListStatementsGlobals, z.ZodTypeDef, unknown > = z.object({ "X-Moov-Version": z.string().optional(), }).transform((v) => { return remap$(v, { "X-Moov-Version": "xMoovVersion", }); }); /** @internal */ export type ListStatementsGlobals$Outbound = { "X-Moov-Version"?: string | undefined; }; /** @internal */ export const ListStatementsGlobals$outboundSchema: z.ZodType< ListStatementsGlobals$Outbound, z.ZodTypeDef, ListStatementsGlobals > = z.object({ xMoovVersion: z.string().optional(), }).transform((v) => { return remap$(v, { xMoovVersion: "X-Moov-Version", }); }); export function listStatementsGlobalsToJSON( listStatementsGlobals: ListStatementsGlobals, ): string { return JSON.stringify( ListStatementsGlobals$outboundSchema.parse(listStatementsGlobals), ); } export function listStatementsGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListStatementsGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListStatementsGlobals' from JSON`, ); } /** @internal */ export const ListStatementsRequest$inboundSchema: z.ZodType< ListStatementsRequest, z.ZodTypeDef, unknown > = z.object({ billingPeriodStartDateTime: z.string().datetime({ offset: true }).transform( v => new Date(v) ).optional(), billingPeriodEndDateTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), skip: z.number().int().optional(), count: z.number().int().optional(), accountID: z.string(), }); /** @internal */ export type ListStatementsRequest$Outbound = { billingPeriodStartDateTime?: string | undefined; billingPeriodEndDateTime?: string | undefined; skip?: number | undefined; count?: number | undefined; accountID: string; }; /** @internal */ export const ListStatementsRequest$outboundSchema: z.ZodType< ListStatementsRequest$Outbound, z.ZodTypeDef, ListStatementsRequest > = z.object({ billingPeriodStartDateTime: z.date().transform(v => v.toISOString()) .optional(), billingPeriodEndDateTime: z.date().transform(v => v.toISOString()).optional(), skip: z.number().int().optional(), count: z.number().int().optional(), accountID: z.string(), }); export function listStatementsRequestToJSON( listStatementsRequest: ListStatementsRequest, ): string { return JSON.stringify( ListStatementsRequest$outboundSchema.parse(listStatementsRequest), ); } export function listStatementsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListStatementsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListStatementsRequest' from JSON`, ); } /** @internal */ export const ListStatementsResponse$inboundSchema: z.ZodType< ListStatementsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: z.array(components.Statement$inboundSchema), }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); /** @internal */ export type ListStatementsResponse$Outbound = { Headers: { [k: string]: Array }; Result: Array; }; /** @internal */ export const ListStatementsResponse$outboundSchema: z.ZodType< ListStatementsResponse$Outbound, z.ZodTypeDef, ListStatementsResponse > = z.object({ headers: z.record(z.array(z.string())), result: z.array(components.Statement$outboundSchema), }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function listStatementsResponseToJSON( listStatementsResponse: ListStatementsResponse, ): string { return JSON.stringify( ListStatementsResponse$outboundSchema.parse(listStatementsResponse), ); } export function listStatementsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListStatementsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListStatementsResponse' from JSON`, ); }