experimentallocationrep.ts•2.12 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";
export type ExperimentAllocationRep = {
defaultVariation: number;
canReshuffle: boolean;
};
/** @internal */
export const ExperimentAllocationRep$inboundSchema: z.ZodType<
ExperimentAllocationRep,
z.ZodTypeDef,
unknown
> = z.object({
defaultVariation: z.number().int(),
canReshuffle: z.boolean(),
});
/** @internal */
export type ExperimentAllocationRep$Outbound = {
defaultVariation: number;
canReshuffle: boolean;
};
/** @internal */
export const ExperimentAllocationRep$outboundSchema: z.ZodType<
ExperimentAllocationRep$Outbound,
z.ZodTypeDef,
ExperimentAllocationRep
> = z.object({
defaultVariation: z.number().int(),
canReshuffle: z.boolean(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ExperimentAllocationRep$ {
/** @deprecated use `ExperimentAllocationRep$inboundSchema` instead. */
export const inboundSchema = ExperimentAllocationRep$inboundSchema;
/** @deprecated use `ExperimentAllocationRep$outboundSchema` instead. */
export const outboundSchema = ExperimentAllocationRep$outboundSchema;
/** @deprecated use `ExperimentAllocationRep$Outbound` instead. */
export type Outbound = ExperimentAllocationRep$Outbound;
}
export function experimentAllocationRepToJSON(
experimentAllocationRep: ExperimentAllocationRep,
): string {
return JSON.stringify(
ExperimentAllocationRep$outboundSchema.parse(experimentAllocationRep),
);
}
export function experimentAllocationRepFromJSON(
jsonString: string,
): SafeParseResult<ExperimentAllocationRep, SDKValidationError> {
return safeParse(
jsonString,
(x) => ExperimentAllocationRep$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ExperimentAllocationRep' from JSON`,
);
}