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