/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetAvailableFeaturesRequest = { /** * Futures contract symbol */ symbols?: Array | null | undefined; /** * Dataset key to which the features */ datasetKeys?: Array | null | undefined; /** * Calculate how strongly a feature affects a given commodity */ featuresStrength?: boolean | undefined; /** * Filter by statistic_type */ statisticTypes?: Array | null | undefined; /** * Filter by variable_type */ variableTypes?: Array | null | undefined; /** * Filter by source */ sources?: Array | null | undefined; /** * Filter by country */ countries?: Array | null | undefined; /** * Filter by frequency */ frequencies?: Array | null | undefined; /** * Filter by phenology_stage or phenology_phase */ phenologyStages?: Array | null | undefined; /** * Maximum number of results to return (required). Maximum is 1000. */ limit: number; /** * Number of results to skip before returning (required) */ offset: number; /** * Search string to match against feature fields. */ search?: string | null | undefined; }; /** @internal */ export const GetAvailableFeaturesRequest$inboundSchema: z.ZodType< GetAvailableFeaturesRequest, z.ZodTypeDef, unknown > = z.object({ symbols: z.nullable(z.array(z.string())).optional(), dataset_keys: z.nullable(z.array(z.string())).optional(), features_strength: z.boolean().default(false), statistic_types: z.nullable(z.array(z.string())).optional(), variable_types: z.nullable(z.array(z.string())).optional(), sources: z.nullable(z.array(z.string())).optional(), countries: z.nullable(z.array(z.string())).optional(), frequencies: z.nullable(z.array(z.string())).optional(), phenology_stages: z.nullable(z.array(z.string())).optional(), limit: z.number().int(), offset: z.number().int(), search: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "dataset_keys": "datasetKeys", "features_strength": "featuresStrength", "statistic_types": "statisticTypes", "variable_types": "variableTypes", "phenology_stages": "phenologyStages", }); }); /** @internal */ export type GetAvailableFeaturesRequest$Outbound = { symbols?: Array | null | undefined; dataset_keys?: Array | null | undefined; features_strength: boolean; statistic_types?: Array | null | undefined; variable_types?: Array | null | undefined; sources?: Array | null | undefined; countries?: Array | null | undefined; frequencies?: Array | null | undefined; phenology_stages?: Array | null | undefined; limit: number; offset: number; search?: string | null | undefined; }; /** @internal */ export const GetAvailableFeaturesRequest$outboundSchema: z.ZodType< GetAvailableFeaturesRequest$Outbound, z.ZodTypeDef, GetAvailableFeaturesRequest > = z.object({ symbols: z.nullable(z.array(z.string())).optional(), datasetKeys: z.nullable(z.array(z.string())).optional(), featuresStrength: z.boolean().default(false), statisticTypes: z.nullable(z.array(z.string())).optional(), variableTypes: z.nullable(z.array(z.string())).optional(), sources: z.nullable(z.array(z.string())).optional(), countries: z.nullable(z.array(z.string())).optional(), frequencies: z.nullable(z.array(z.string())).optional(), phenologyStages: z.nullable(z.array(z.string())).optional(), limit: z.number().int(), offset: z.number().int(), search: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { datasetKeys: "dataset_keys", featuresStrength: "features_strength", statisticTypes: "statistic_types", variableTypes: "variable_types", phenologyStages: "phenology_stages", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetAvailableFeaturesRequest$ { /** @deprecated use `GetAvailableFeaturesRequest$inboundSchema` instead. */ export const inboundSchema = GetAvailableFeaturesRequest$inboundSchema; /** @deprecated use `GetAvailableFeaturesRequest$outboundSchema` instead. */ export const outboundSchema = GetAvailableFeaturesRequest$outboundSchema; /** @deprecated use `GetAvailableFeaturesRequest$Outbound` instead. */ export type Outbound = GetAvailableFeaturesRequest$Outbound; } export function getAvailableFeaturesRequestToJSON( getAvailableFeaturesRequest: GetAvailableFeaturesRequest, ): string { return JSON.stringify( GetAvailableFeaturesRequest$outboundSchema.parse( getAvailableFeaturesRequest, ), ); } export function getAvailableFeaturesRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetAvailableFeaturesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetAvailableFeaturesRequest' from JSON`, ); }