@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>
122 lines (109 loc) • 3.26 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 { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type GetRuntimeLogsRequest = {
projectId: string;
deploymentId: 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;
};
export const GetRuntimeLogsLevel = {
Debug: "debug",
Error: "error",
Fatal: "fatal",
Info: "info",
Trace: "trace",
Warning: "warning",
} as const;
export type GetRuntimeLogsLevel = ClosedEnum<typeof GetRuntimeLogsLevel>;
export const GetRuntimeLogsSource = {
Delimiter: "delimiter",
EdgeFunction: "edge-function",
EdgeMiddleware: "edge-middleware",
Request: "request",
Serverless: "serverless",
} as const;
export type GetRuntimeLogsSource = ClosedEnum<typeof GetRuntimeLogsSource>;
export type GetRuntimeLogsResponseBody = {
level: GetRuntimeLogsLevel;
message: string;
rowId: string;
source: GetRuntimeLogsSource;
timestampInMs: number;
domain: string;
messageTruncated: boolean;
requestMethod: string;
requestPath: string;
responseStatusCode: number;
};
/** @internal */
export type GetRuntimeLogsRequest$Outbound = {
projectId: string;
deploymentId: string;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetRuntimeLogsRequest$outboundSchema: z.ZodType<
GetRuntimeLogsRequest$Outbound,
z.ZodTypeDef,
GetRuntimeLogsRequest
> = z.object({
projectId: z.string(),
deploymentId: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getRuntimeLogsRequestToJSON(
getRuntimeLogsRequest: GetRuntimeLogsRequest,
): string {
return JSON.stringify(
GetRuntimeLogsRequest$outboundSchema.parse(getRuntimeLogsRequest),
);
}
/** @internal */
export const GetRuntimeLogsLevel$inboundSchema: z.ZodNativeEnum<
typeof GetRuntimeLogsLevel
> = z.nativeEnum(GetRuntimeLogsLevel);
/** @internal */
export const GetRuntimeLogsSource$inboundSchema: z.ZodNativeEnum<
typeof GetRuntimeLogsSource
> = z.nativeEnum(GetRuntimeLogsSource);
/** @internal */
export const GetRuntimeLogsResponseBody$inboundSchema: z.ZodType<
GetRuntimeLogsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
level: GetRuntimeLogsLevel$inboundSchema,
message: types.string(),
rowId: types.string(),
source: GetRuntimeLogsSource$inboundSchema,
timestampInMs: types.number(),
domain: types.string(),
messageTruncated: types.boolean(),
requestMethod: types.string(),
requestPath: types.string(),
responseStatusCode: types.number(),
});
export function getRuntimeLogsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetRuntimeLogsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetRuntimeLogsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetRuntimeLogsResponseBody' from JSON`,
);
}