@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>
209 lines (192 loc) • 5.49 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 { 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 GetBypassIpRequest = {
projectId: string;
limit?: number | undefined;
/**
* Filter by source IP
*/
sourceIp?: string | undefined;
/**
* Filter by domain
*/
domain?: string | undefined;
/**
* Filter by project scoped rules
*/
projectScope?: boolean | undefined;
/**
* Used for pagination. Retrieves results after the provided id
*/
offset?: 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;
};
export const GetBypassIpAction = {
Block: "block",
Bypass: "bypass",
} as const;
export type GetBypassIpAction = ClosedEnum<typeof GetBypassIpAction>;
export type GetBypassIpResult = {
ownerId: string;
id: string;
domain: string;
ip: string;
action?: GetBypassIpAction | undefined;
projectId?: string | undefined;
isProjectRule?: boolean | undefined;
note?: string | undefined;
createdAt: string;
actorId?: string | undefined;
updatedAt: string;
updatedAtHour: string;
deletedAt?: string | undefined;
expiresAt?: number | null | undefined;
};
export type GetBypassIpPagination = {
ownerId: string;
id: string;
};
export type GetBypassIpResponseBody = {
result: Array<GetBypassIpResult>;
pagination?: GetBypassIpPagination | undefined;
};
/** @internal */
export type GetBypassIpRequest$Outbound = {
projectId: string;
limit?: number | undefined;
sourceIp?: string | undefined;
domain?: string | undefined;
projectScope?: boolean | undefined;
offset?: string | undefined;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetBypassIpRequest$outboundSchema: z.ZodType<
GetBypassIpRequest$Outbound,
z.ZodTypeDef,
GetBypassIpRequest
> = z.object({
projectId: z.string(),
limit: z.number().optional(),
sourceIp: z.string().optional(),
domain: z.string().optional(),
projectScope: z.boolean().optional(),
offset: z.string().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getBypassIpRequestToJSON(
getBypassIpRequest: GetBypassIpRequest,
): string {
return JSON.stringify(
GetBypassIpRequest$outboundSchema.parse(getBypassIpRequest),
);
}
/** @internal */
export const GetBypassIpAction$inboundSchema: z.ZodNativeEnum<
typeof GetBypassIpAction
> = z.nativeEnum(GetBypassIpAction);
/** @internal */
export const GetBypassIpResult$inboundSchema: z.ZodType<
GetBypassIpResult,
z.ZodTypeDef,
unknown
> = z.object({
OwnerId: types.string(),
Id: types.string(),
Domain: types.string(),
Ip: types.string(),
Action: types.optional(GetBypassIpAction$inboundSchema),
ProjectId: types.optional(types.string()),
IsProjectRule: types.optional(types.boolean()),
Note: types.optional(types.string()),
CreatedAt: types.string(),
ActorId: types.optional(types.string()),
UpdatedAt: types.string(),
UpdatedAtHour: types.string(),
DeletedAt: types.optional(types.string()),
ExpiresAt: z.nullable(types.number()).optional(),
}).transform((v) => {
return remap$(v, {
"OwnerId": "ownerId",
"Id": "id",
"Domain": "domain",
"Ip": "ip",
"Action": "action",
"ProjectId": "projectId",
"IsProjectRule": "isProjectRule",
"Note": "note",
"CreatedAt": "createdAt",
"ActorId": "actorId",
"UpdatedAt": "updatedAt",
"UpdatedAtHour": "updatedAtHour",
"DeletedAt": "deletedAt",
"ExpiresAt": "expiresAt",
});
});
export function getBypassIpResultFromJSON(
jsonString: string,
): SafeParseResult<GetBypassIpResult, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetBypassIpResult$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetBypassIpResult' from JSON`,
);
}
/** @internal */
export const GetBypassIpPagination$inboundSchema: z.ZodType<
GetBypassIpPagination,
z.ZodTypeDef,
unknown
> = z.object({
OwnerId: types.string(),
Id: types.string(),
}).transform((v) => {
return remap$(v, {
"OwnerId": "ownerId",
"Id": "id",
});
});
export function getBypassIpPaginationFromJSON(
jsonString: string,
): SafeParseResult<GetBypassIpPagination, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetBypassIpPagination$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetBypassIpPagination' from JSON`,
);
}
/** @internal */
export const GetBypassIpResponseBody$inboundSchema: z.ZodType<
GetBypassIpResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
result: z.array(z.lazy(() => GetBypassIpResult$inboundSchema)),
pagination: types.optional(z.lazy(() => GetBypassIpPagination$inboundSchema)),
});
export function getBypassIpResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetBypassIpResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetBypassIpResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetBypassIpResponseBody' from JSON`,
);
}