@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>
127 lines (114 loc) • 3.58 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 { SDKValidationError } from "./sdkvalidationerror.js";
export type CreateSessionDirectoryRequestBody = {
/**
* The base directory for resolving relative paths. If not specified, paths are resolved from the sandbox home directory.
*/
cwd?: string | undefined;
/**
* The path of the directory to create. Can be absolute or relative to the working directory.
*/
path: string;
/**
* If true, creates parent directories as needed (like `mkdir -p`). If false, fails if parent directories do not exist.
*/
recursive?: boolean | undefined;
};
export type CreateSessionDirectoryRequest = {
/**
* The unique identifier of the session to create the directory in.
*/
sessionId: 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?: CreateSessionDirectoryRequestBody | undefined;
};
/**
* The directory was created successfully.
*/
export type CreateSessionDirectoryResponseBody = {};
/** @internal */
export type CreateSessionDirectoryRequestBody$Outbound = {
cwd?: string | undefined;
path: string;
recursive: boolean;
};
/** @internal */
export const CreateSessionDirectoryRequestBody$outboundSchema: z.ZodType<
CreateSessionDirectoryRequestBody$Outbound,
z.ZodTypeDef,
CreateSessionDirectoryRequestBody
> = z.object({
cwd: z.string().optional(),
path: z.string(),
recursive: z.boolean().default(true),
});
export function createSessionDirectoryRequestBodyToJSON(
createSessionDirectoryRequestBody: CreateSessionDirectoryRequestBody,
): string {
return JSON.stringify(
CreateSessionDirectoryRequestBody$outboundSchema.parse(
createSessionDirectoryRequestBody,
),
);
}
/** @internal */
export type CreateSessionDirectoryRequest$Outbound = {
sessionId: string;
teamId?: string | undefined;
slug?: string | undefined;
RequestBody?: CreateSessionDirectoryRequestBody$Outbound | undefined;
};
/** @internal */
export const CreateSessionDirectoryRequest$outboundSchema: z.ZodType<
CreateSessionDirectoryRequest$Outbound,
z.ZodTypeDef,
CreateSessionDirectoryRequest
> = z.object({
sessionId: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => CreateSessionDirectoryRequestBody$outboundSchema)
.optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function createSessionDirectoryRequestToJSON(
createSessionDirectoryRequest: CreateSessionDirectoryRequest,
): string {
return JSON.stringify(
CreateSessionDirectoryRequest$outboundSchema.parse(
createSessionDirectoryRequest,
),
);
}
/** @internal */
export const CreateSessionDirectoryResponseBody$inboundSchema: z.ZodType<
CreateSessionDirectoryResponseBody,
z.ZodTypeDef,
unknown
> = z.object({});
export function createSessionDirectoryResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<CreateSessionDirectoryResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
CreateSessionDirectoryResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateSessionDirectoryResponseBody' from JSON`,
);
}