@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
169 lines (154 loc) • 4.75 kB
text/typescript
/*
* 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 { smartUnion } from "../types/smartUnion.js";
import {
BoughtTooRecently,
BoughtTooRecently$inboundSchema,
} from "./boughttoorecently.js";
import {
ContactPendingVerification,
ContactPendingVerification$inboundSchema,
} from "./contactpendingverification.js";
import {
ContactVerified,
ContactVerified$inboundSchema,
} from "./contactverified.js";
import {
DomainNotRegistered,
DomainNotRegistered$inboundSchema,
} from "./domainnotregistered.js";
import { Forbidden, Forbidden$inboundSchema } from "./forbidden.js";
import {
HttpApiDecodeError,
HttpApiDecodeError$inboundSchema,
} from "./httpapidecodeerror.js";
import {
NotAuthorizedForScope,
NotAuthorizedForScope$inboundSchema,
} from "./notauthorizedforscope.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type GetDomainContactVerificationRequest = {
domain: string;
teamId?: string | undefined;
};
/**
* NotAuthorizedForScope
*/
export type GetDomainContactVerificationDomainsRegistrarResponseResponseBody =
| (NotAuthorizedForScope & { code: "not_authorized_for_scope" })
| Forbidden;
/**
* There was something wrong with the request
*/
export type GetDomainContactVerificationDomainsRegistrarResponseBody =
| BoughtTooRecently
| DomainNotRegistered
| HttpApiDecodeError;
/**
* The registrant contact has been verified.
*/
export type GetDomainContactVerificationResponseBody =
| ContactPendingVerification
| ContactVerified;
/** @internal */
export type GetDomainContactVerificationRequest$Outbound = {
domain: string;
teamId?: string | undefined;
};
/** @internal */
export const GetDomainContactVerificationRequest$outboundSchema: z.ZodType<
GetDomainContactVerificationRequest$Outbound,
z.ZodTypeDef,
GetDomainContactVerificationRequest
> = z.object({
domain: z.string(),
teamId: z.string().optional(),
});
export function getDomainContactVerificationRequestToJSON(
getDomainContactVerificationRequest: GetDomainContactVerificationRequest,
): string {
return JSON.stringify(
GetDomainContactVerificationRequest$outboundSchema.parse(
getDomainContactVerificationRequest,
),
);
}
/** @internal */
export const GetDomainContactVerificationDomainsRegistrarResponseResponseBody$inboundSchema:
z.ZodType<
GetDomainContactVerificationDomainsRegistrarResponseResponseBody,
z.ZodTypeDef,
unknown
> = z.union([
NotAuthorizedForScope$inboundSchema.and(
z.object({ code: z.literal("not_authorized_for_scope") }),
),
Forbidden$inboundSchema,
]);
export function getDomainContactVerificationDomainsRegistrarResponseResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<
GetDomainContactVerificationDomainsRegistrarResponseResponseBody,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetDomainContactVerificationDomainsRegistrarResponseResponseBody$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'GetDomainContactVerificationDomainsRegistrarResponseResponseBody' from JSON`,
);
}
/** @internal */
export const GetDomainContactVerificationDomainsRegistrarResponseBody$inboundSchema:
z.ZodType<
GetDomainContactVerificationDomainsRegistrarResponseBody,
z.ZodTypeDef,
unknown
> = smartUnion([
BoughtTooRecently$inboundSchema,
DomainNotRegistered$inboundSchema,
HttpApiDecodeError$inboundSchema,
]);
export function getDomainContactVerificationDomainsRegistrarResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<
GetDomainContactVerificationDomainsRegistrarResponseBody,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetDomainContactVerificationDomainsRegistrarResponseBody$inboundSchema
.parse(JSON.parse(x)),
`Failed to parse 'GetDomainContactVerificationDomainsRegistrarResponseBody' from JSON`,
);
}
/** @internal */
export const GetDomainContactVerificationResponseBody$inboundSchema: z.ZodType<
GetDomainContactVerificationResponseBody,
z.ZodTypeDef,
unknown
> = smartUnion([
ContactPendingVerification$inboundSchema,
ContactVerified$inboundSchema,
]);
export function getDomainContactVerificationResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<
GetDomainContactVerificationResponseBody,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
GetDomainContactVerificationResponseBody$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'GetDomainContactVerificationResponseBody' from JSON`,
);
}