@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>
165 lines (149 loc) • 4.52 kB
text/typescript
/*
* 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 { Result as SafeParseResult } from "../types/fp.js";
import { smartUnion } from "../types/smartUnion.js";
import {
DomainAlreadyRenewing,
DomainAlreadyRenewing$inboundSchema,
} from "./domainalreadyrenewing.js";
import {
DomainNotRegistered,
DomainNotRegistered$inboundSchema,
} from "./domainnotregistered.js";
import {
DomainNotRenewable,
DomainNotRenewable$inboundSchema,
} from "./domainnotrenewable.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 UpdateDomainAutoRenewRequestBody = {
autoRenew: boolean;
};
export type UpdateDomainAutoRenewRequest = {
domain: string;
teamId?: string | undefined;
requestBody: UpdateDomainAutoRenewRequestBody;
};
/**
* NotAuthorizedForScope
*/
export type UpdateDomainAutoRenewDomainsRegistrarResponseBody =
| (NotAuthorizedForScope & { code: "not_authorized_for_scope" })
| Forbidden;
/**
* There was something wrong with the request
*/
export type UpdateDomainAutoRenewResponseBody =
| DomainAlreadyRenewing
| DomainNotRenewable
| DomainNotRegistered
| HttpApiDecodeError;
/** @internal */
export type UpdateDomainAutoRenewRequestBody$Outbound = {
autoRenew: boolean;
};
/** @internal */
export const UpdateDomainAutoRenewRequestBody$outboundSchema: z.ZodType<
UpdateDomainAutoRenewRequestBody$Outbound,
z.ZodTypeDef,
UpdateDomainAutoRenewRequestBody
> = z.object({
autoRenew: z.boolean(),
});
export function updateDomainAutoRenewRequestBodyToJSON(
updateDomainAutoRenewRequestBody: UpdateDomainAutoRenewRequestBody,
): string {
return JSON.stringify(
UpdateDomainAutoRenewRequestBody$outboundSchema.parse(
updateDomainAutoRenewRequestBody,
),
);
}
/** @internal */
export type UpdateDomainAutoRenewRequest$Outbound = {
domain: string;
teamId?: string | undefined;
RequestBody: UpdateDomainAutoRenewRequestBody$Outbound;
};
/** @internal */
export const UpdateDomainAutoRenewRequest$outboundSchema: z.ZodType<
UpdateDomainAutoRenewRequest$Outbound,
z.ZodTypeDef,
UpdateDomainAutoRenewRequest
> = z.object({
domain: z.string(),
teamId: z.string().optional(),
requestBody: z.lazy(() => UpdateDomainAutoRenewRequestBody$outboundSchema),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function updateDomainAutoRenewRequestToJSON(
updateDomainAutoRenewRequest: UpdateDomainAutoRenewRequest,
): string {
return JSON.stringify(
UpdateDomainAutoRenewRequest$outboundSchema.parse(
updateDomainAutoRenewRequest,
),
);
}
/** @internal */
export const UpdateDomainAutoRenewDomainsRegistrarResponseBody$inboundSchema:
z.ZodType<
UpdateDomainAutoRenewDomainsRegistrarResponseBody,
z.ZodTypeDef,
unknown
> = z.union([
NotAuthorizedForScope$inboundSchema.and(
z.object({ code: z.literal("not_authorized_for_scope") }),
),
Forbidden$inboundSchema,
]);
export function updateDomainAutoRenewDomainsRegistrarResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<
UpdateDomainAutoRenewDomainsRegistrarResponseBody,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
UpdateDomainAutoRenewDomainsRegistrarResponseBody$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'UpdateDomainAutoRenewDomainsRegistrarResponseBody' from JSON`,
);
}
/** @internal */
export const UpdateDomainAutoRenewResponseBody$inboundSchema: z.ZodType<
UpdateDomainAutoRenewResponseBody,
z.ZodTypeDef,
unknown
> = smartUnion([
DomainAlreadyRenewing$inboundSchema,
DomainNotRenewable$inboundSchema,
DomainNotRegistered$inboundSchema,
HttpApiDecodeError$inboundSchema,
]);
export function updateDomainAutoRenewResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<UpdateDomainAutoRenewResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => UpdateDomainAutoRenewResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'UpdateDomainAutoRenewResponseBody' from JSON`,
);
}