aiconfigtargetingpatch.ts•2.28 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 AIConfigTargetingPatch = {
comment?: string | undefined;
environmentKey: string;
instructions: Array<{ [k: string]: any }>;
};
/** @internal */
export const AIConfigTargetingPatch$inboundSchema: z.ZodType<
AIConfigTargetingPatch,
z.ZodTypeDef,
unknown
> = z.object({
comment: z.string().optional(),
environmentKey: z.string(),
instructions: z.array(z.record(z.any())),
});
/** @internal */
export type AIConfigTargetingPatch$Outbound = {
comment?: string | undefined;
environmentKey: string;
instructions: Array<{ [k: string]: any }>;
};
/** @internal */
export const AIConfigTargetingPatch$outboundSchema: z.ZodType<
AIConfigTargetingPatch$Outbound,
z.ZodTypeDef,
AIConfigTargetingPatch
> = z.object({
comment: z.string().optional(),
environmentKey: z.string(),
instructions: z.array(z.record(z.any())),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AIConfigTargetingPatch$ {
/** @deprecated use `AIConfigTargetingPatch$inboundSchema` instead. */
export const inboundSchema = AIConfigTargetingPatch$inboundSchema;
/** @deprecated use `AIConfigTargetingPatch$outboundSchema` instead. */
export const outboundSchema = AIConfigTargetingPatch$outboundSchema;
/** @deprecated use `AIConfigTargetingPatch$Outbound` instead. */
export type Outbound = AIConfigTargetingPatch$Outbound;
}
export function aiConfigTargetingPatchToJSON(
aiConfigTargetingPatch: AIConfigTargetingPatch,
): string {
return JSON.stringify(
AIConfigTargetingPatch$outboundSchema.parse(aiConfigTargetingPatch),
);
}
export function aiConfigTargetingPatchFromJSON(
jsonString: string,
): SafeParseResult<AIConfigTargetingPatch, SDKValidationError> {
return safeParse(
jsonString,
(x) => AIConfigTargetingPatch$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AIConfigTargetingPatch' from JSON`,
);
}