aiconfigsmodification.ts•2.04 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 AiConfigsModification = {
date?: Date | undefined;
};
/** @internal */
export const AiConfigsModification$inboundSchema: z.ZodType<
AiConfigsModification,
z.ZodTypeDef,
unknown
> = z.object({
date: z.string().datetime({ offset: true }).transform(v => new Date(v))
.optional(),
});
/** @internal */
export type AiConfigsModification$Outbound = {
date?: string | undefined;
};
/** @internal */
export const AiConfigsModification$outboundSchema: z.ZodType<
AiConfigsModification$Outbound,
z.ZodTypeDef,
AiConfigsModification
> = z.object({
date: z.date().transform(v => v.toISOString()).optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace AiConfigsModification$ {
/** @deprecated use `AiConfigsModification$inboundSchema` instead. */
export const inboundSchema = AiConfigsModification$inboundSchema;
/** @deprecated use `AiConfigsModification$outboundSchema` instead. */
export const outboundSchema = AiConfigsModification$outboundSchema;
/** @deprecated use `AiConfigsModification$Outbound` instead. */
export type Outbound = AiConfigsModification$Outbound;
}
export function aiConfigsModificationToJSON(
aiConfigsModification: AiConfigsModification,
): string {
return JSON.stringify(
AiConfigsModification$outboundSchema.parse(aiConfigsModification),
);
}
export function aiConfigsModificationFromJSON(
jsonString: string,
): SafeParseResult<AiConfigsModification, SDKValidationError> {
return safeParse(
jsonString,
(x) => AiConfigsModification$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AiConfigsModification' from JSON`,
);
}