/* * 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 GetWeightedIndexRequest = { /** * The list of weights to apply on the features selection to create the index */ weights: Array; /** * The list of features to include in the index */ featureCodes: Array; /** * user defined string used to name the weighted index */ indexLabel: string; /** * Start of transformed feature data window (YYYY-MM-DD) */ startDate?: string | null | undefined; /** * End of transformed feature data window (YYYY-MM-DD) */ endDate?: string | null | undefined; }; /** @internal */ export const GetWeightedIndexRequest$inboundSchema: z.ZodType< GetWeightedIndexRequest, z.ZodTypeDef, unknown > = z.object({ weights: z.array(z.number()), feature_codes: z.array(z.string()), index_label: z.string(), start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "feature_codes": "featureCodes", "index_label": "indexLabel", "start_date": "startDate", "end_date": "endDate", }); }); /** @internal */ export type GetWeightedIndexRequest$Outbound = { weights: Array; feature_codes: Array; index_label: string; start_date?: string | null | undefined; end_date?: string | null | undefined; }; /** @internal */ export const GetWeightedIndexRequest$outboundSchema: z.ZodType< GetWeightedIndexRequest$Outbound, z.ZodTypeDef, GetWeightedIndexRequest > = z.object({ weights: z.array(z.number()), featureCodes: z.array(z.string()), indexLabel: z.string(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { featureCodes: "feature_codes", indexLabel: "index_label", startDate: "start_date", endDate: "end_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetWeightedIndexRequest$ { /** @deprecated use `GetWeightedIndexRequest$inboundSchema` instead. */ export const inboundSchema = GetWeightedIndexRequest$inboundSchema; /** @deprecated use `GetWeightedIndexRequest$outboundSchema` instead. */ export const outboundSchema = GetWeightedIndexRequest$outboundSchema; /** @deprecated use `GetWeightedIndexRequest$Outbound` instead. */ export type Outbound = GetWeightedIndexRequest$Outbound; } export function getWeightedIndexRequestToJSON( getWeightedIndexRequest: GetWeightedIndexRequest, ): string { return JSON.stringify( GetWeightedIndexRequest$outboundSchema.parse(getWeightedIndexRequest), ); } export function getWeightedIndexRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetWeightedIndexRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetWeightedIndexRequest' from JSON`, ); }