/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type FeatureHistoricalData = { featureCode: string; date: RFCDate; value: number; strength?: number | null | undefined; phenologyStage?: string | null | undefined; }; /** @internal */ export const FeatureHistoricalData$inboundSchema: z.ZodType< FeatureHistoricalData, z.ZodTypeDef, unknown > = z.object({ feature_code: z.string(), date: z.string().transform(v => new RFCDate(v)), value: z.number(), strength: z.nullable(z.number()).optional(), phenology_stage: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "feature_code": "featureCode", "phenology_stage": "phenologyStage", }); }); /** @internal */ export type FeatureHistoricalData$Outbound = { feature_code: string; date: string; value: number; strength?: number | null | undefined; phenology_stage?: string | null | undefined; }; /** @internal */ export const FeatureHistoricalData$outboundSchema: z.ZodType< FeatureHistoricalData$Outbound, z.ZodTypeDef, FeatureHistoricalData > = z.object({ featureCode: z.string(), date: z.instanceof(RFCDate).transform(v => v.toString()), value: z.number(), strength: z.nullable(z.number()).optional(), phenologyStage: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { featureCode: "feature_code", phenologyStage: "phenology_stage", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FeatureHistoricalData$ { /** @deprecated use `FeatureHistoricalData$inboundSchema` instead. */ export const inboundSchema = FeatureHistoricalData$inboundSchema; /** @deprecated use `FeatureHistoricalData$outboundSchema` instead. */ export const outboundSchema = FeatureHistoricalData$outboundSchema; /** @deprecated use `FeatureHistoricalData$Outbound` instead. */ export type Outbound = FeatureHistoricalData$Outbound; } export function featureHistoricalDataToJSON( featureHistoricalData: FeatureHistoricalData, ): string { return JSON.stringify( FeatureHistoricalData$outboundSchema.parse(featureHistoricalData), ); } export function featureHistoricalDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeatureHistoricalData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeatureHistoricalData' from JSON`, ); }