/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const ListMcpCredentialsQueryParamOrder = { Asc: "asc", Desc: "desc", } as const; export type ListMcpCredentialsQueryParamOrder = ClosedEnum< typeof ListMcpCredentialsQueryParamOrder >; export type IncludeRevoked = boolean | string; export type ListMcpCredentialsRequest = { serverId: string; limit?: number | undefined; after?: string | undefined; order?: ListMcpCredentialsQueryParamOrder | undefined; includeRevoked?: boolean | string | undefined; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; /** @internal */ export const ListMcpCredentialsQueryParamOrder$inboundSchema: z.ZodNativeEnum< typeof ListMcpCredentialsQueryParamOrder > = z.nativeEnum(ListMcpCredentialsQueryParamOrder); /** @internal */ export const ListMcpCredentialsQueryParamOrder$outboundSchema: z.ZodNativeEnum< typeof ListMcpCredentialsQueryParamOrder > = ListMcpCredentialsQueryParamOrder$inboundSchema; /** @internal */ export const IncludeRevoked$inboundSchema: z.ZodType< IncludeRevoked, z.ZodTypeDef, unknown > = z.union([z.boolean(), z.string()]); /** @internal */ export type IncludeRevoked$Outbound = boolean | string; /** @internal */ export const IncludeRevoked$outboundSchema: z.ZodType< IncludeRevoked$Outbound, z.ZodTypeDef, IncludeRevoked > = z.union([z.boolean(), z.string()]); export function includeRevokedToJSON(includeRevoked: IncludeRevoked): string { return JSON.stringify(IncludeRevoked$outboundSchema.parse(includeRevoked)); } export function includeRevokedFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IncludeRevoked$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IncludeRevoked' from JSON`, ); } /** @internal */ export const ListMcpCredentialsRequest$inboundSchema: z.ZodType< ListMcpCredentialsRequest, z.ZodTypeDef, unknown > = z.object({ server_id: z.string(), limit: z.number().int().default(20), after: z.string().optional(), order: ListMcpCredentialsQueryParamOrder$inboundSchema.default("desc"), include_revoked: z.union([z.boolean(), z.string()]).optional(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "server_id": "serverId", "include_revoked": "includeRevoked", "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListMcpCredentialsRequest$Outbound = { server_id: string; limit: number; after?: string | undefined; order: string; include_revoked?: boolean | string | undefined; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListMcpCredentialsRequest$outboundSchema: z.ZodType< ListMcpCredentialsRequest$Outbound, z.ZodTypeDef, ListMcpCredentialsRequest > = z.object({ serverId: z.string(), limit: z.number().int().default(20), after: z.string().optional(), order: ListMcpCredentialsQueryParamOrder$outboundSchema.default("desc"), includeRevoked: z.union([z.boolean(), z.string()]).optional(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { serverId: "server_id", includeRevoked: "include_revoked", xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listMcpCredentialsRequestToJSON( listMcpCredentialsRequest: ListMcpCredentialsRequest, ): string { return JSON.stringify( ListMcpCredentialsRequest$outboundSchema.parse(listMcpCredentialsRequest), ); } export function listMcpCredentialsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListMcpCredentialsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListMcpCredentialsRequest' from JSON`, ); }