UNPKG

@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>

384 lines (356 loc) 9.88 kB
/* * 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 * as types from "../types/primitives.js"; import { smartUnion } from "../types/smartUnion.js"; import { BadRequest, BadRequest$inboundSchema } from "./badrequest.js"; import { DNSSECEnabled, DNSSECEnabled$inboundSchema } from "./dnssecenabled.js"; import { DomainAlreadyOwned, DomainAlreadyOwned$inboundSchema, } from "./domainalreadyowned.js"; import { DomainNotAvailable, DomainNotAvailable$inboundSchema, } from "./domainnotavailable.js"; import { DomainTooShort, DomainTooShort$inboundSchema, } from "./domaintooshort.js"; import { ExpectedPriceMismatch, ExpectedPriceMismatch$inboundSchema, } from "./expectedpricemismatch.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"; import { TldNotSupported, TldNotSupported$inboundSchema, } from "./tldnotsupported.js"; export type TransferInDomainContactInformation = { /** * a non empty string */ firstName: string; /** * a non empty string */ lastName: string; /** * A valid RFC 5322 email address */ email: string; /** * A valid E.164 phone number */ phone: string; /** * a non empty string */ address1: string; /** * a non empty string */ address2?: string | undefined; /** * a non empty string */ city: string; /** * a non empty string */ state: string; /** * a non empty string */ zip: string; /** * A valid ISO 3166-1 alpha-2 country code */ country: string; /** * a non empty string */ companyName?: string | undefined; /** * A valid E.164 phone number */ fax?: string | undefined; }; export type TransferInDomainRequestBody = { /** * The auth code for the domain. You must obtain this code from the losing registrar. */ authCode: string; /** * Whether the domain should be auto-renewed before it expires. This can be configured later through the Vercel Dashboard or the [Update auto-renew for a domain](https://vercel.com/docs/rest-api/reference/endpoints/domains-registrar/update-auto-renew-for-a-domain) endpoint. */ autoRenew: boolean; /** * The number of years to renew the domain for once it is transferred in. This must be a valid number of transfer years for the TLD. */ years: number; expectedPrice: number; contactInformation: TransferInDomainContactInformation; }; export type TransferInDomainRequest = { domain: string; teamId?: string | undefined; requestBody: TransferInDomainRequestBody; }; /** * NotAuthorizedForScope */ export type TransferInDomainDomainsRegistrarResponseResponseBody = | (NotAuthorizedForScope & { code: "not_authorized_for_scope" }) | Forbidden; /** * There was something wrong with the request */ export type TransferInDomainDomainsRegistrarResponseBody = | BadRequest | DomainAlreadyOwned | DomainTooShort | DNSSECEnabled | ExpectedPriceMismatch | DomainNotAvailable | TldNotSupported | HttpApiDecodeError; export const TransferInDomainMethod = { Get: "GET", Post: "POST", Put: "PUT", Delete: "DELETE", Patch: "PATCH", } as const; export type TransferInDomainMethod = ClosedEnum<typeof TransferInDomainMethod>; export type TransferInDomainLinks = { href: string; method: TransferInDomainMethod; }; /** * Success */ export type TransferInDomainResponseBody = { /** * A valid order ID */ orderId: string; links: { [k: string]: TransferInDomainLinks }; }; /** @internal */ export type TransferInDomainContactInformation$Outbound = { firstName: string; lastName: string; email: string; phone: string; address1: string; address2?: string | undefined; city: string; state: string; zip: string; country: string; companyName?: string | undefined; fax?: string | undefined; }; /** @internal */ export const TransferInDomainContactInformation$outboundSchema: z.ZodType< TransferInDomainContactInformation$Outbound, z.ZodTypeDef, TransferInDomainContactInformation > = z.object({ firstName: z.string(), lastName: z.string(), email: z.string(), phone: z.string(), address1: z.string(), address2: z.string().optional(), city: z.string(), state: z.string(), zip: z.string(), country: z.string(), companyName: z.string().optional(), fax: z.string().optional(), }); export function transferInDomainContactInformationToJSON( transferInDomainContactInformation: TransferInDomainContactInformation, ): string { return JSON.stringify( TransferInDomainContactInformation$outboundSchema.parse( transferInDomainContactInformation, ), ); } /** @internal */ export type TransferInDomainRequestBody$Outbound = { authCode: string; autoRenew: boolean; years: number; expectedPrice: number; contactInformation: TransferInDomainContactInformation$Outbound; }; /** @internal */ export const TransferInDomainRequestBody$outboundSchema: z.ZodType< TransferInDomainRequestBody$Outbound, z.ZodTypeDef, TransferInDomainRequestBody > = z.object({ authCode: z.string(), autoRenew: z.boolean(), years: z.number(), expectedPrice: z.number(), contactInformation: z.lazy(() => TransferInDomainContactInformation$outboundSchema ), }); export function transferInDomainRequestBodyToJSON( transferInDomainRequestBody: TransferInDomainRequestBody, ): string { return JSON.stringify( TransferInDomainRequestBody$outboundSchema.parse( transferInDomainRequestBody, ), ); } /** @internal */ export type TransferInDomainRequest$Outbound = { domain: string; teamId?: string | undefined; RequestBody: TransferInDomainRequestBody$Outbound; }; /** @internal */ export const TransferInDomainRequest$outboundSchema: z.ZodType< TransferInDomainRequest$Outbound, z.ZodTypeDef, TransferInDomainRequest > = z.object({ domain: z.string(), teamId: z.string().optional(), requestBody: z.lazy(() => TransferInDomainRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function transferInDomainRequestToJSON( transferInDomainRequest: TransferInDomainRequest, ): string { return JSON.stringify( TransferInDomainRequest$outboundSchema.parse(transferInDomainRequest), ); } /** @internal */ export const TransferInDomainDomainsRegistrarResponseResponseBody$inboundSchema: z.ZodType< TransferInDomainDomainsRegistrarResponseResponseBody, z.ZodTypeDef, unknown > = z.union([ NotAuthorizedForScope$inboundSchema.and( z.object({ code: z.literal("not_authorized_for_scope") }), ), Forbidden$inboundSchema, ]); export function transferInDomainDomainsRegistrarResponseResponseBodyFromJSON( jsonString: string, ): SafeParseResult< TransferInDomainDomainsRegistrarResponseResponseBody, SDKValidationError > { return safeParse( jsonString, (x) => TransferInDomainDomainsRegistrarResponseResponseBody$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'TransferInDomainDomainsRegistrarResponseResponseBody' from JSON`, ); } /** @internal */ export const TransferInDomainDomainsRegistrarResponseBody$inboundSchema: z.ZodType< TransferInDomainDomainsRegistrarResponseBody, z.ZodTypeDef, unknown > = smartUnion([ BadRequest$inboundSchema, DomainAlreadyOwned$inboundSchema, DomainTooShort$inboundSchema, DNSSECEnabled$inboundSchema, ExpectedPriceMismatch$inboundSchema, DomainNotAvailable$inboundSchema, TldNotSupported$inboundSchema, HttpApiDecodeError$inboundSchema, ]); export function transferInDomainDomainsRegistrarResponseBodyFromJSON( jsonString: string, ): SafeParseResult< TransferInDomainDomainsRegistrarResponseBody, SDKValidationError > { return safeParse( jsonString, (x) => TransferInDomainDomainsRegistrarResponseBody$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'TransferInDomainDomainsRegistrarResponseBody' from JSON`, ); } /** @internal */ export const TransferInDomainMethod$inboundSchema: z.ZodNativeEnum< typeof TransferInDomainMethod > = z.nativeEnum(TransferInDomainMethod); /** @internal */ export const TransferInDomainLinks$inboundSchema: z.ZodType< TransferInDomainLinks, z.ZodTypeDef, unknown > = z.object({ href: types.string(), method: TransferInDomainMethod$inboundSchema, }); export function transferInDomainLinksFromJSON( jsonString: string, ): SafeParseResult<TransferInDomainLinks, SDKValidationError> { return safeParse( jsonString, (x) => TransferInDomainLinks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransferInDomainLinks' from JSON`, ); } /** @internal */ export const TransferInDomainResponseBody$inboundSchema: z.ZodType< TransferInDomainResponseBody, z.ZodTypeDef, unknown > = z.object({ orderId: types.string(), _links: z.record(z.lazy(() => TransferInDomainLinks$inboundSchema)), }).transform((v) => { return remap$(v, { "_links": "links", }); }); export function transferInDomainResponseBodyFromJSON( jsonString: string, ): SafeParseResult<TransferInDomainResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => TransferInDomainResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransferInDomainResponseBody' from JSON`, ); }