@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>
134 lines (119 loc) • 3.77 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 { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type GetDeploymentFeatureFlagsRequest = {
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 type GetDeploymentFeatureFlagsFlags = {};
export type GetDeploymentFeatureFlagsStatus = {
deploymentId: string;
projectId: string;
/**
* The HTTP status code from the flags discovery endpoint.
*/
responseStatus: number;
/**
* The number of flag definitions returned by the flags discovery endpoint.
*/
flagCount: number;
createdAt: number;
};
export type GetDeploymentFeatureFlagsResponseBody = {
flags: Array<GetDeploymentFeatureFlagsFlags>;
status: GetDeploymentFeatureFlagsStatus | null;
};
/** @internal */
export type GetDeploymentFeatureFlagsRequest$Outbound = {
deploymentId: string;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetDeploymentFeatureFlagsRequest$outboundSchema: z.ZodType<
GetDeploymentFeatureFlagsRequest$Outbound,
z.ZodTypeDef,
GetDeploymentFeatureFlagsRequest
> = z.object({
deploymentId: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getDeploymentFeatureFlagsRequestToJSON(
getDeploymentFeatureFlagsRequest: GetDeploymentFeatureFlagsRequest,
): string {
return JSON.stringify(
GetDeploymentFeatureFlagsRequest$outboundSchema.parse(
getDeploymentFeatureFlagsRequest,
),
);
}
/** @internal */
export const GetDeploymentFeatureFlagsFlags$inboundSchema: z.ZodType<
GetDeploymentFeatureFlagsFlags,
z.ZodTypeDef,
unknown
> = z.object({});
export function getDeploymentFeatureFlagsFlagsFromJSON(
jsonString: string,
): SafeParseResult<GetDeploymentFeatureFlagsFlags, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetDeploymentFeatureFlagsFlags$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetDeploymentFeatureFlagsFlags' from JSON`,
);
}
/** @internal */
export const GetDeploymentFeatureFlagsStatus$inboundSchema: z.ZodType<
GetDeploymentFeatureFlagsStatus,
z.ZodTypeDef,
unknown
> = z.object({
deploymentId: types.string(),
projectId: types.string(),
responseStatus: types.number(),
flagCount: types.number(),
createdAt: types.number(),
});
export function getDeploymentFeatureFlagsStatusFromJSON(
jsonString: string,
): SafeParseResult<GetDeploymentFeatureFlagsStatus, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetDeploymentFeatureFlagsStatus$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetDeploymentFeatureFlagsStatus' from JSON`,
);
}
/** @internal */
export const GetDeploymentFeatureFlagsResponseBody$inboundSchema: z.ZodType<
GetDeploymentFeatureFlagsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
flags: z.array(z.lazy(() => GetDeploymentFeatureFlagsFlags$inboundSchema)),
status: types.nullable(
z.lazy(() => GetDeploymentFeatureFlagsStatus$inboundSchema),
),
});
export function getDeploymentFeatureFlagsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetDeploymentFeatureFlagsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
GetDeploymentFeatureFlagsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetDeploymentFeatureFlagsResponseBody' from JSON`,
);
}