/* * 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 LogResource = { id?: number | undefined; time?: Date | undefined; exception?: string | null | undefined; exceptionType?: string | null | undefined; level?: string | null | undefined; logger?: string | null | undefined; message?: string | null | undefined; method?: string | null | undefined; }; /** @internal */ export const LogResource$inboundSchema: z.ZodType< LogResource, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), time: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), exception: z.nullable(z.string()).optional(), exceptionType: z.nullable(z.string()).optional(), level: z.nullable(z.string()).optional(), logger: z.nullable(z.string()).optional(), message: z.nullable(z.string()).optional(), method: z.nullable(z.string()).optional(), }); /** @internal */ export type LogResource$Outbound = { id?: number | undefined; time?: string | undefined; exception?: string | null | undefined; exceptionType?: string | null | undefined; level?: string | null | undefined; logger?: string | null | undefined; message?: string | null | undefined; method?: string | null | undefined; }; /** @internal */ export const LogResource$outboundSchema: z.ZodType< LogResource$Outbound, z.ZodTypeDef, LogResource > = z.object({ id: z.number().int().optional(), time: z.date().transform(v => v.toISOString()).optional(), exception: z.nullable(z.string()).optional(), exceptionType: z.nullable(z.string()).optional(), level: z.nullable(z.string()).optional(), logger: z.nullable(z.string()).optional(), message: z.nullable(z.string()).optional(), method: z.nullable(z.string()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LogResource$ { /** @deprecated use `LogResource$inboundSchema` instead. */ export const inboundSchema = LogResource$inboundSchema; /** @deprecated use `LogResource$outboundSchema` instead. */ export const outboundSchema = LogResource$outboundSchema; /** @deprecated use `LogResource$Outbound` instead. */ export type Outbound = LogResource$Outbound; } export function logResourceToJSON(logResource: LogResource): string { return JSON.stringify(LogResource$outboundSchema.parse(logResource)); } export function logResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LogResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogResource' from JSON`, ); }