/* * 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"; export const Region = { Wildcard: "*", } as const; export type Region = ClosedEnum; export const City = { Wildcard: "*", } as const; export type City = ClosedEnum; export type AnalyticsCountries = { /** * The 2-letter ISO 3166-1 country code of the country. Learn more: https://d.to/geo */ country: string; region: Region; city: City; /** * The number of clicks from this country */ clicks: number; /** * The number of leads from this country */ leads: number; /** * The number of sales from this country */ sales: number; /** * The total amount of sales from this country, in cents */ saleAmount: number; }; /** @internal */ export const Region$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Region); /** @internal */ export const City$inboundSchema: z.ZodNativeEnum = z.nativeEnum( City, ); /** @internal */ export const AnalyticsCountries$inboundSchema: z.ZodType< AnalyticsCountries, z.ZodTypeDef, unknown > = z.object({ country: z.string(), region: Region$inboundSchema.default("*"), city: City$inboundSchema.default("*"), clicks: z.number().default(0), leads: z.number().default(0), sales: z.number().default(0), saleAmount: z.number().default(0), }); export function analyticsCountriesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AnalyticsCountries$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnalyticsCountries' from JSON`, ); }