aiconfigtargetingenvironmentfallthrough.ts•3.1 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 {
AIConfigTargetingEnvironmentFallthroughRollout,
AIConfigTargetingEnvironmentFallthroughRollout$inboundSchema,
AIConfigTargetingEnvironmentFallthroughRollout$Outbound,
AIConfigTargetingEnvironmentFallthroughRollout$outboundSchema,
} from "./aiconfigtargetingenvironmentfallthroughrollout.js";
export type AIConfigTargetingEnvironmentFallthrough = {
variation?: number | undefined;
rollout?: AIConfigTargetingEnvironmentFallthroughRollout | undefined;
};
/** @internal */
export const AIConfigTargetingEnvironmentFallthrough$inboundSchema: z.ZodType<
AIConfigTargetingEnvironmentFallthrough,
z.ZodTypeDef,
unknown
> = z.object({
variation: z.number().int().optional(),
rollout: AIConfigTargetingEnvironmentFallthroughRollout$inboundSchema
.optional(),
});
/** @internal */
export type AIConfigTargetingEnvironmentFallthrough$Outbound = {
variation?: number | undefined;
rollout?: AIConfigTargetingEnvironmentFallthroughRollout$Outbound | undefined;
};
/** @internal */
export const AIConfigTargetingEnvironmentFallthrough$outboundSchema: z.ZodType<
AIConfigTargetingEnvironmentFallthrough$Outbound,
z.ZodTypeDef,
AIConfigTargetingEnvironmentFallthrough
> = z.object({
variation: z.number().int().optional(),
rollout: AIConfigTargetingEnvironmentFallthroughRollout$outboundSchema
.optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AIConfigTargetingEnvironmentFallthrough$ {
/** @deprecated use `AIConfigTargetingEnvironmentFallthrough$inboundSchema` instead. */
export const inboundSchema =
AIConfigTargetingEnvironmentFallthrough$inboundSchema;
/** @deprecated use `AIConfigTargetingEnvironmentFallthrough$outboundSchema` instead. */
export const outboundSchema =
AIConfigTargetingEnvironmentFallthrough$outboundSchema;
/** @deprecated use `AIConfigTargetingEnvironmentFallthrough$Outbound` instead. */
export type Outbound = AIConfigTargetingEnvironmentFallthrough$Outbound;
}
export function aiConfigTargetingEnvironmentFallthroughToJSON(
aiConfigTargetingEnvironmentFallthrough:
AIConfigTargetingEnvironmentFallthrough,
): string {
return JSON.stringify(
AIConfigTargetingEnvironmentFallthrough$outboundSchema.parse(
aiConfigTargetingEnvironmentFallthrough,
),
);
}
export function aiConfigTargetingEnvironmentFallthroughFromJSON(
jsonString: string,
): SafeParseResult<
AIConfigTargetingEnvironmentFallthrough,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
AIConfigTargetingEnvironmentFallthrough$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'AIConfigTargetingEnvironmentFallthrough' from JSON`,
);
}