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