@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>
110 lines (97 loc) • 3.01 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 PatchEdgeConfigSchemaRequestBody = {
definition?: any | undefined;
};
export type PatchEdgeConfigSchemaRequest = {
edgeConfigId: string;
dryRun?: string | undefined;
/**
* 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: PatchEdgeConfigSchemaRequestBody;
};
/**
* The JSON schema uploaded by the user
*/
export type PatchEdgeConfigSchemaResponseBody = {};
/** @internal */
export type PatchEdgeConfigSchemaRequestBody$Outbound = {
definition?: any | undefined;
};
/** @internal */
export const PatchEdgeConfigSchemaRequestBody$outboundSchema: z.ZodType<
PatchEdgeConfigSchemaRequestBody$Outbound,
z.ZodTypeDef,
PatchEdgeConfigSchemaRequestBody
> = z.object({
definition: z.any().optional(),
});
export function patchEdgeConfigSchemaRequestBodyToJSON(
patchEdgeConfigSchemaRequestBody: PatchEdgeConfigSchemaRequestBody,
): string {
return JSON.stringify(
PatchEdgeConfigSchemaRequestBody$outboundSchema.parse(
patchEdgeConfigSchemaRequestBody,
),
);
}
/** @internal */
export type PatchEdgeConfigSchemaRequest$Outbound = {
edgeConfigId: string;
dryRun?: string | undefined;
teamId?: string | undefined;
slug?: string | undefined;
RequestBody: PatchEdgeConfigSchemaRequestBody$Outbound;
};
/** @internal */
export const PatchEdgeConfigSchemaRequest$outboundSchema: z.ZodType<
PatchEdgeConfigSchemaRequest$Outbound,
z.ZodTypeDef,
PatchEdgeConfigSchemaRequest
> = z.object({
edgeConfigId: z.string(),
dryRun: z.string().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => PatchEdgeConfigSchemaRequestBody$outboundSchema),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function patchEdgeConfigSchemaRequestToJSON(
patchEdgeConfigSchemaRequest: PatchEdgeConfigSchemaRequest,
): string {
return JSON.stringify(
PatchEdgeConfigSchemaRequest$outboundSchema.parse(
patchEdgeConfigSchemaRequest,
),
);
}
/** @internal */
export const PatchEdgeConfigSchemaResponseBody$inboundSchema: z.ZodType<
PatchEdgeConfigSchemaResponseBody,
z.ZodTypeDef,
unknown
> = z.object({});
export function patchEdgeConfigSchemaResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<PatchEdgeConfigSchemaResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => PatchEdgeConfigSchemaResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'PatchEdgeConfigSchemaResponseBody' from JSON`,
);
}