getaiconfigvariation.ts•3.99 kB
/*
* 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 { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* Version of the endpoint.
*/
export const GetAIConfigVariationLDAPIVersion = {
Beta: "beta",
} as const;
/**
* Version of the endpoint.
*/
export type GetAIConfigVariationLDAPIVersion = ClosedEnum<
typeof GetAIConfigVariationLDAPIVersion
>;
export type GetAIConfigVariationRequest = {
/**
* Version of the endpoint.
*/
ldAPIVersion: GetAIConfigVariationLDAPIVersion;
projectKey: string;
configKey: string;
variationKey: string;
};
/** @internal */
export const GetAIConfigVariationLDAPIVersion$inboundSchema: z.ZodNativeEnum<
typeof GetAIConfigVariationLDAPIVersion
> = z.nativeEnum(GetAIConfigVariationLDAPIVersion);
/** @internal */
export const GetAIConfigVariationLDAPIVersion$outboundSchema: z.ZodNativeEnum<
typeof GetAIConfigVariationLDAPIVersion
> = GetAIConfigVariationLDAPIVersion$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetAIConfigVariationLDAPIVersion$ {
/** @deprecated use `GetAIConfigVariationLDAPIVersion$inboundSchema` instead. */
export const inboundSchema = GetAIConfigVariationLDAPIVersion$inboundSchema;
/** @deprecated use `GetAIConfigVariationLDAPIVersion$outboundSchema` instead. */
export const outboundSchema = GetAIConfigVariationLDAPIVersion$outboundSchema;
}
/** @internal */
export const GetAIConfigVariationRequest$inboundSchema: z.ZodType<
GetAIConfigVariationRequest,
z.ZodTypeDef,
unknown
> = z.object({
"LD-API-Version": GetAIConfigVariationLDAPIVersion$inboundSchema,
projectKey: z.string(),
configKey: z.string(),
variationKey: z.string(),
}).transform((v) => {
return remap$(v, {
"LD-API-Version": "ldAPIVersion",
});
});
/** @internal */
export type GetAIConfigVariationRequest$Outbound = {
"LD-API-Version": string;
projectKey: string;
configKey: string;
variationKey: string;
};
/** @internal */
export const GetAIConfigVariationRequest$outboundSchema: z.ZodType<
GetAIConfigVariationRequest$Outbound,
z.ZodTypeDef,
GetAIConfigVariationRequest
> = z.object({
ldAPIVersion: GetAIConfigVariationLDAPIVersion$outboundSchema,
projectKey: z.string(),
configKey: z.string(),
variationKey: z.string(),
}).transform((v) => {
return remap$(v, {
ldAPIVersion: "LD-API-Version",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace GetAIConfigVariationRequest$ {
/** @deprecated use `GetAIConfigVariationRequest$inboundSchema` instead. */
export const inboundSchema = GetAIConfigVariationRequest$inboundSchema;
/** @deprecated use `GetAIConfigVariationRequest$outboundSchema` instead. */
export const outboundSchema = GetAIConfigVariationRequest$outboundSchema;
/** @deprecated use `GetAIConfigVariationRequest$Outbound` instead. */
export type Outbound = GetAIConfigVariationRequest$Outbound;
}
export function getAIConfigVariationRequestToJSON(
getAIConfigVariationRequest: GetAIConfigVariationRequest,
): string {
return JSON.stringify(
GetAIConfigVariationRequest$outboundSchema.parse(
getAIConfigVariationRequest,
),
);
}
export function getAIConfigVariationRequestFromJSON(
jsonString: string,
): SafeParseResult<GetAIConfigVariationRequest, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetAIConfigVariationRequest$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetAIConfigVariationRequest' from JSON`,
);
}