/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UserLocation = { type?: "approximate" | undefined; city?: string | undefined; country?: string | undefined; region?: string | undefined; timezone?: string | undefined; }; /** @internal */ export const UserLocation$inboundSchema: z.ZodType< UserLocation, z.ZodTypeDef, unknown > = z.object({ type: z.literal("approximate").default("approximate"), city: z.string().optional(), country: z.string().optional(), region: z.string().optional(), timezone: z.string().optional(), }); /** @internal */ export type UserLocation$Outbound = { type: "approximate"; city?: string | undefined; country?: string | undefined; region?: string | undefined; timezone?: string | undefined; }; /** @internal */ export const UserLocation$outboundSchema: z.ZodType< UserLocation$Outbound, z.ZodTypeDef, UserLocation > = z.object({ type: z.literal("approximate").default("approximate" as const), city: z.string().optional(), country: z.string().optional(), region: z.string().optional(), timezone: z.string().optional(), }); export function userLocationToJSON(userLocation: UserLocation): string { return JSON.stringify(UserLocation$outboundSchema.parse(userLocation)); } export function userLocationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UserLocation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UserLocation' from JSON`, ); }