/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Groups time-series data into buckets of this size. Requires startDate and endDate. Returns a periods array with one entry per bucket containing grossRevenue and netRevenue. */ export const Interval = { Day: "day", Week: "week", Month: "month", } as const; /** * Groups time-series data into buckets of this size. Requires startDate and endDate. Returns a periods array with one entry per bucket containing grossRevenue and netRevenue. */ export type Interval = ClosedEnum; export const Currency = { Eur: "EUR", Usd: "USD", } as const; export type Currency = ClosedEnum; export type GetMetricsSummaryRequest = { /** * Start of the date range as a Unix timestamp in milliseconds (e.g. 1740614400000). When provided with endDate, filters totals to this range. Required when interval is specified. */ startDate?: number | undefined; /** * End of the date range as a Unix timestamp in milliseconds (e.g. 1772150400000). When provided with startDate, filters totals to this range. Required when interval is specified. */ endDate?: number | undefined; /** * Groups time-series data into buckets of this size. Requires startDate and endDate. Returns a periods array with one entry per bucket containing grossRevenue and netRevenue. */ interval?: Interval | undefined; currency: Currency; }; /** @internal */ export const Interval$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Interval); /** @internal */ export const Interval$outboundSchema: z.ZodNativeEnum = Interval$inboundSchema; /** @internal */ export const Currency$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Currency); /** @internal */ export const Currency$outboundSchema: z.ZodNativeEnum = Currency$inboundSchema; /** @internal */ export const GetMetricsSummaryRequest$inboundSchema: z.ZodType< GetMetricsSummaryRequest, z.ZodTypeDef, unknown > = z.object({ startDate: z.number().optional(), endDate: z.number().optional(), interval: Interval$inboundSchema.optional(), currency: Currency$inboundSchema, }); /** @internal */ export type GetMetricsSummaryRequest$Outbound = { startDate?: number | undefined; endDate?: number | undefined; interval?: string | undefined; currency: string; }; /** @internal */ export const GetMetricsSummaryRequest$outboundSchema: z.ZodType< GetMetricsSummaryRequest$Outbound, z.ZodTypeDef, GetMetricsSummaryRequest > = z.object({ startDate: z.number().optional(), endDate: z.number().optional(), interval: Interval$outboundSchema.optional(), currency: Currency$outboundSchema, }); export function getMetricsSummaryRequestToJSON( getMetricsSummaryRequest: GetMetricsSummaryRequest, ): string { return JSON.stringify( GetMetricsSummaryRequest$outboundSchema.parse(getMetricsSummaryRequest), ); } export function getMetricsSummaryRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetMetricsSummaryRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetMetricsSummaryRequest' from JSON`, ); }