/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKError } from "./sdkerror.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; /** * Internal server error */ export type GetJwtFromKeyAuthApiKeyResponseResponseBodyData = { /** * Error message describing why the request failed. */ message: string; }; /** * Internal server error */ export class GetJwtFromKeyAuthApiKeyResponseResponseBody extends SDKError { /** The original data that was passed to this error instance. */ data$: GetJwtFromKeyAuthApiKeyResponseResponseBodyData; constructor( err: GetJwtFromKeyAuthApiKeyResponseResponseBodyData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.name = "GetJwtFromKeyAuthApiKeyResponseResponseBody"; } } /** * Unauthorized */ export type GetJwtFromKeyAuthApiKeyResponseBodyData = { /** * Error message describing why the request failed. */ message: string; }; /** * Unauthorized */ export class GetJwtFromKeyAuthApiKeyResponseBody extends SDKError { /** The original data that was passed to this error instance. */ data$: GetJwtFromKeyAuthApiKeyResponseBodyData; constructor( err: GetJwtFromKeyAuthApiKeyResponseBodyData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.name = "GetJwtFromKeyAuthApiKeyResponseBody"; } } export type Details = { /** * Dot-path of the invalid field in the request body. */ path: string; /** * Validation error message for the field. */ message: string; }; /** * Invalid request body */ export type GetJwtFromKeyResponseBodyData = { /** * Top-level validation error summary for the request body. */ message: string; /** * List of field-level validation errors. */ details: Array
; }; /** * Invalid request body */ export class GetJwtFromKeyResponseBody extends SDKError { /** * List of field-level validation errors. */ details: Array
; /** The original data that was passed to this error instance. */ data$: GetJwtFromKeyResponseBodyData; constructor( err: GetJwtFromKeyResponseBodyData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.details = err.details; this.name = "GetJwtFromKeyResponseBody"; } } /** @internal */ export const GetJwtFromKeyAuthApiKeyResponseResponseBody$inboundSchema: z.ZodType< GetJwtFromKeyAuthApiKeyResponseResponseBody, z.ZodTypeDef, unknown > = z.object({ message: z.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new GetJwtFromKeyAuthApiKeyResponseResponseBody(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type GetJwtFromKeyAuthApiKeyResponseResponseBody$Outbound = { message: string; }; /** @internal */ export const GetJwtFromKeyAuthApiKeyResponseResponseBody$outboundSchema: z.ZodType< GetJwtFromKeyAuthApiKeyResponseResponseBody$Outbound, z.ZodTypeDef, GetJwtFromKeyAuthApiKeyResponseResponseBody > = z.instanceof(GetJwtFromKeyAuthApiKeyResponseResponseBody) .transform(v => v.data$) .pipe(z.object({ message: z.string(), })); /** @internal */ export const GetJwtFromKeyAuthApiKeyResponseBody$inboundSchema: z.ZodType< GetJwtFromKeyAuthApiKeyResponseBody, z.ZodTypeDef, unknown > = z.object({ message: z.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new GetJwtFromKeyAuthApiKeyResponseBody(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type GetJwtFromKeyAuthApiKeyResponseBody$Outbound = { message: string; }; /** @internal */ export const GetJwtFromKeyAuthApiKeyResponseBody$outboundSchema: z.ZodType< GetJwtFromKeyAuthApiKeyResponseBody$Outbound, z.ZodTypeDef, GetJwtFromKeyAuthApiKeyResponseBody > = z.instanceof(GetJwtFromKeyAuthApiKeyResponseBody) .transform(v => v.data$) .pipe(z.object({ message: z.string(), })); /** @internal */ export const Details$inboundSchema: z.ZodType = z.object({ path: z.string(), message: z.string(), }); /** @internal */ export type Details$Outbound = { path: string; message: string; }; /** @internal */ export const Details$outboundSchema: z.ZodType< Details$Outbound, z.ZodTypeDef, Details > = z.object({ path: z.string(), message: z.string(), }); export function detailsToJSON(details: Details): string { return JSON.stringify(Details$outboundSchema.parse(details)); } export function detailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Details$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Details' from JSON`, ); } /** @internal */ export const GetJwtFromKeyResponseBody$inboundSchema: z.ZodType< GetJwtFromKeyResponseBody, z.ZodTypeDef, unknown > = z.object({ message: z.string(), details: z.array(z.lazy(() => Details$inboundSchema)), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new GetJwtFromKeyResponseBody(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type GetJwtFromKeyResponseBody$Outbound = { message: string; details: Array; }; /** @internal */ export const GetJwtFromKeyResponseBody$outboundSchema: z.ZodType< GetJwtFromKeyResponseBody$Outbound, z.ZodTypeDef, GetJwtFromKeyResponseBody > = z.instanceof(GetJwtFromKeyResponseBody) .transform(v => v.data$) .pipe(z.object({ message: z.string(), details: z.array(z.lazy(() => Details$outboundSchema)), }));