mirror of
https://github.com/LukeHagar/dub-node.git
synced 2025-12-06 04:19:37 +00:00
128 lines
3.4 KiB
TypeScript
128 lines
3.4 KiB
TypeScript
/*
|
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
*/
|
|
|
|
import { remap as remap$ } from "../../lib/primitives";
|
|
import { ClosedEnum } from "../../types";
|
|
import * as z from "zod";
|
|
|
|
/**
|
|
* 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<typeof InviteExpiredCode>;
|
|
|
|
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 Error {
|
|
error: InviteExpiredError;
|
|
|
|
/** The original data that was passed to this error instance. */
|
|
data$: InviteExpiredData;
|
|
|
|
constructor(err: InviteExpiredData) {
|
|
super("");
|
|
this.data$ = err;
|
|
|
|
this.error = err.error;
|
|
|
|
this.message =
|
|
"message" in err && typeof err.message === "string"
|
|
? err.message
|
|
: "API error occurred";
|
|
|
|
this.name = "InviteExpired";
|
|
}
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace InviteExpiredCode$ {
|
|
export const inboundSchema = z.nativeEnum(InviteExpiredCode);
|
|
export const outboundSchema = inboundSchema;
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace InviteExpiredError$ {
|
|
export const 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 type Outbound = {
|
|
code: string;
|
|
message: string;
|
|
doc_url?: string | undefined;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, InviteExpiredError> = z
|
|
.object({
|
|
code: InviteExpiredCode$.outboundSchema,
|
|
message: z.string(),
|
|
docUrl: z.string().optional(),
|
|
})
|
|
.transform((v) => {
|
|
return remap$(v, {
|
|
docUrl: "doc_url",
|
|
});
|
|
});
|
|
}
|
|
|
|
/** @internal */
|
|
export namespace InviteExpired$ {
|
|
export const inboundSchema: z.ZodType<InviteExpired, z.ZodTypeDef, unknown> = z
|
|
.object({
|
|
error: z.lazy(() => InviteExpiredError$.inboundSchema),
|
|
})
|
|
.transform((v) => {
|
|
return new InviteExpired(v);
|
|
});
|
|
|
|
export type Outbound = {
|
|
error: InviteExpiredError$.Outbound;
|
|
};
|
|
|
|
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, InviteExpired> = z
|
|
.instanceof(InviteExpired)
|
|
.transform((v) => v.data$)
|
|
.pipe(
|
|
z.object({
|
|
error: z.lazy(() => InviteExpiredError$.outboundSchema),
|
|
})
|
|
);
|
|
}
|