experimentinforep.ts•2.22 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
LegacyExperimentRep,
LegacyExperimentRep$inboundSchema,
LegacyExperimentRep$Outbound,
LegacyExperimentRep$outboundSchema,
} from "./legacyexperimentrep.js";
export type ExperimentInfoRep = {
baselineIdx: number;
items: Array<LegacyExperimentRep>;
};
/** @internal */
export const ExperimentInfoRep$inboundSchema: z.ZodType<
ExperimentInfoRep,
z.ZodTypeDef,
unknown
> = z.object({
baselineIdx: z.number().int(),
items: z.array(LegacyExperimentRep$inboundSchema),
});
/** @internal */
export type ExperimentInfoRep$Outbound = {
baselineIdx: number;
items: Array<LegacyExperimentRep$Outbound>;
};
/** @internal */
export const ExperimentInfoRep$outboundSchema: z.ZodType<
ExperimentInfoRep$Outbound,
z.ZodTypeDef,
ExperimentInfoRep
> = z.object({
baselineIdx: z.number().int(),
items: z.array(LegacyExperimentRep$outboundSchema),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ExperimentInfoRep$ {
/** @deprecated use `ExperimentInfoRep$inboundSchema` instead. */
export const inboundSchema = ExperimentInfoRep$inboundSchema;
/** @deprecated use `ExperimentInfoRep$outboundSchema` instead. */
export const outboundSchema = ExperimentInfoRep$outboundSchema;
/** @deprecated use `ExperimentInfoRep$Outbound` instead. */
export type Outbound = ExperimentInfoRep$Outbound;
}
export function experimentInfoRepToJSON(
experimentInfoRep: ExperimentInfoRep,
): string {
return JSON.stringify(
ExperimentInfoRep$outboundSchema.parse(experimentInfoRep),
);
}
export function experimentInfoRepFromJSON(
jsonString: string,
): SafeParseResult<ExperimentInfoRep, SDKValidationError> {
return safeParse(
jsonString,
(x) => ExperimentInfoRep$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ExperimentInfoRep' from JSON`,
);
}