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