/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { DubError } from "./duberror.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; /** * A short code indicating the error code returned. */ export const InviteExpiredCode = { InviteExpired: "invite_expired", } as const; /** * A short code indicating the error code returned. */ export type InviteExpiredCode = ClosedEnum; export type InviteExpiredError = { /** * A short code indicating the error code returned. */ code: InviteExpiredCode; /** * A human readable explanation of what went wrong. */ message: string; /** * A link to our documentation with more details about this error code */ docUrl?: string | undefined; }; /** * This response is sent when the requested content has been permanently deleted from server, with no forwarding address. */ export type InviteExpiredData = { error: InviteExpiredError; }; /** * This response is sent when the requested content has been permanently deleted from server, with no forwarding address. */ export class InviteExpired extends DubError { error: InviteExpiredError; /** The original data that was passed to this error instance. */ data$: InviteExpiredData; constructor( err: InviteExpiredData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.error?.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.error = err.error; this.name = "InviteExpired"; } } /** @internal */ export const InviteExpiredCode$inboundSchema: z.ZodNativeEnum< typeof InviteExpiredCode > = z.nativeEnum(InviteExpiredCode); /** @internal */ export const InviteExpiredError$inboundSchema: z.ZodType< InviteExpiredError, z.ZodTypeDef, unknown > = z.object({ code: InviteExpiredCode$inboundSchema, message: z.string(), doc_url: z.string().optional(), }).transform((v) => { return remap$(v, { "doc_url": "docUrl", }); }); export function inviteExpiredErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InviteExpiredError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InviteExpiredError' from JSON`, ); } /** @internal */ export const InviteExpired$inboundSchema: z.ZodType< InviteExpired, z.ZodTypeDef, unknown > = z.object({ error: z.lazy(() => InviteExpiredError$inboundSchema), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new InviteExpired(v, { request: v.request$, response: v.response$, body: v.body$, }); });