@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>
133 lines (120 loc) • 3.65 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 * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type CreateProjectTransferRequestRequestBody = {
/**
* The URL to send a webhook to when the transfer is accepted.
*/
callbackUrl?: string | undefined;
/**
* The secret to use to sign the webhook payload with HMAC-SHA256.
*/
callbackSecret?: string | undefined;
};
export type CreateProjectTransferRequestRequest = {
/**
* The ID or name of the project to transfer.
*/
idOrName: string;
/**
* The Team identifier to perform the request on behalf of.
*/
teamId?: string | undefined;
/**
* The Team slug to perform the request on behalf of.
*/
slug?: string | undefined;
requestBody?: CreateProjectTransferRequestRequestBody | undefined;
};
/**
* The project transfer request has been initiated successfully.
*/
export type CreateProjectTransferRequestResponseBody = {
code: string;
};
/** @internal */
export type CreateProjectTransferRequestRequestBody$Outbound = {
callbackUrl?: string | undefined;
callbackSecret?: string | undefined;
};
/** @internal */
export const CreateProjectTransferRequestRequestBody$outboundSchema: z.ZodType<
CreateProjectTransferRequestRequestBody$Outbound,
z.ZodTypeDef,
CreateProjectTransferRequestRequestBody
> = z.object({
callbackUrl: z.string().optional(),
callbackSecret: z.string().optional(),
});
export function createProjectTransferRequestRequestBodyToJSON(
createProjectTransferRequestRequestBody:
CreateProjectTransferRequestRequestBody,
): string {
return JSON.stringify(
CreateProjectTransferRequestRequestBody$outboundSchema.parse(
createProjectTransferRequestRequestBody,
),
);
}
/** @internal */
export type CreateProjectTransferRequestRequest$Outbound = {
idOrName: string;
teamId?: string | undefined;
slug?: string | undefined;
RequestBody?: CreateProjectTransferRequestRequestBody$Outbound | undefined;
};
/** @internal */
export const CreateProjectTransferRequestRequest$outboundSchema: z.ZodType<
CreateProjectTransferRequestRequest$Outbound,
z.ZodTypeDef,
CreateProjectTransferRequestRequest
> = z.object({
idOrName: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() =>
CreateProjectTransferRequestRequestBody$outboundSchema
).optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function createProjectTransferRequestRequestToJSON(
createProjectTransferRequestRequest: CreateProjectTransferRequestRequest,
): string {
return JSON.stringify(
CreateProjectTransferRequestRequest$outboundSchema.parse(
createProjectTransferRequestRequest,
),
);
}
/** @internal */
export const CreateProjectTransferRequestResponseBody$inboundSchema: z.ZodType<
CreateProjectTransferRequestResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
code: types.string(),
});
export function createProjectTransferRequestResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<
CreateProjectTransferRequestResponseBody,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
CreateProjectTransferRequestResponseBody$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'CreateProjectTransferRequestResponseBody' from JSON`,
);
}