/* * 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"; import { Any, Any$inboundSchema, Any$Outbound, Any$outboundSchema, } from "./any.js"; /** * The status message serves as the general-purpose service error message. Each status message includes a gRPC error code, error message, and error details. */ export type Status = { /** * The code field contains an enum value of google.rpc.Code. */ code?: number | undefined; /** * The details field contains one or more technical error details. */ details?: Array | undefined; /** * The message field contains human-friendly messages about the error. */ message?: string | undefined; }; /** @internal */ export const Status$inboundSchema: z.ZodType = z .object({ code: z.number().int().optional(), details: z.array(Any$inboundSchema).optional(), message: z.string().optional(), }); /** @internal */ export type Status$Outbound = { code?: number | undefined; details?: Array | undefined; message?: string | undefined; }; /** @internal */ export const Status$outboundSchema: z.ZodType< Status$Outbound, z.ZodTypeDef, Status > = z.object({ code: z.number().int().optional(), details: z.array(Any$outboundSchema).optional(), message: 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 Status$ { /** @deprecated use `Status$inboundSchema` instead. */ export const inboundSchema = Status$inboundSchema; /** @deprecated use `Status$outboundSchema` instead. */ export const outboundSchema = Status$outboundSchema; /** @deprecated use `Status$Outbound` instead. */ export type Outbound = Status$Outbound; } export function statusToJSON(status: Status): string { return JSON.stringify(Status$outboundSchema.parse(status)); } export function statusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Status$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Status' from JSON`, ); }