@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>
174 lines (157 loc) • 4.78 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 ListAccessGroupMembersRequest = {
/**
* The ID or name of the Access Group.
*/
idOrName: string;
/**
* Limit how many access group members should be returned.
*/
limit?: number | undefined;
/**
* Continuation cursor to retrieve the next page of results.
*/
next?: string | undefined;
/**
* Search project members by their name, username, and email.
*/
search?: 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 ListAccessGroupMembersTeamRole = {
Billing: "BILLING",
Contributor: "CONTRIBUTOR",
Developer: "DEVELOPER",
Member: "MEMBER",
Owner: "OWNER",
Security: "SECURITY",
Viewer: "VIEWER",
ViewerForPlus: "VIEWER_FOR_PLUS",
} as const;
export type ListAccessGroupMembersTeamRole = ClosedEnum<
typeof ListAccessGroupMembersTeamRole
>;
export type Members = {
avatar?: string | undefined;
email: string;
uid: string;
username: string;
name?: string | undefined;
createdAt?: string | undefined;
teamRole: ListAccessGroupMembersTeamRole;
};
export type ListAccessGroupMembersPagination = {
count: number;
next: string | null;
};
export type ListAccessGroupMembersResponseBody = {
members: Array<Members>;
pagination: ListAccessGroupMembersPagination;
};
/** @internal */
export type ListAccessGroupMembersRequest$Outbound = {
idOrName: string;
limit?: number | undefined;
next?: string | undefined;
search?: string | undefined;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const ListAccessGroupMembersRequest$outboundSchema: z.ZodType<
ListAccessGroupMembersRequest$Outbound,
z.ZodTypeDef,
ListAccessGroupMembersRequest
> = z.object({
idOrName: z.string(),
limit: z.number().int().optional(),
next: z.string().optional(),
search: z.string().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function listAccessGroupMembersRequestToJSON(
listAccessGroupMembersRequest: ListAccessGroupMembersRequest,
): string {
return JSON.stringify(
ListAccessGroupMembersRequest$outboundSchema.parse(
listAccessGroupMembersRequest,
),
);
}
/** @internal */
export const ListAccessGroupMembersTeamRole$inboundSchema: z.ZodNativeEnum<
typeof ListAccessGroupMembersTeamRole
> = z.nativeEnum(ListAccessGroupMembersTeamRole);
/** @internal */
export const Members$inboundSchema: z.ZodType<Members, z.ZodTypeDef, unknown> =
z.object({
avatar: types.optional(types.string()),
email: types.string(),
uid: types.string(),
username: types.string(),
name: types.optional(types.string()),
createdAt: types.optional(types.string()),
teamRole: ListAccessGroupMembersTeamRole$inboundSchema,
});
export function membersFromJSON(
jsonString: string,
): SafeParseResult<Members, SDKValidationError> {
return safeParse(
jsonString,
(x) => Members$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Members' from JSON`,
);
}
/** @internal */
export const ListAccessGroupMembersPagination$inboundSchema: z.ZodType<
ListAccessGroupMembersPagination,
z.ZodTypeDef,
unknown
> = z.object({
count: types.number(),
next: types.nullable(types.string()),
});
export function listAccessGroupMembersPaginationFromJSON(
jsonString: string,
): SafeParseResult<ListAccessGroupMembersPagination, SDKValidationError> {
return safeParse(
jsonString,
(x) => ListAccessGroupMembersPagination$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ListAccessGroupMembersPagination' from JSON`,
);
}
/** @internal */
export const ListAccessGroupMembersResponseBody$inboundSchema: z.ZodType<
ListAccessGroupMembersResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
members: z.array(z.lazy(() => Members$inboundSchema)),
pagination: z.lazy(() => ListAccessGroupMembersPagination$inboundSchema),
});
export function listAccessGroupMembersResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<ListAccessGroupMembersResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
ListAccessGroupMembersResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ListAccessGroupMembersResponseBody' from JSON`,
);
}