/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: ed5b16732286 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { smartUnion } from "../../types/smartUnion.js"; import { AuthenticationMethodCreateOrUpdateRequest, AuthenticationMethodCreateOrUpdateRequest$Outbound, AuthenticationMethodCreateOrUpdateRequest$outboundSchema, } from "./authenticationmethodcreateorupdaterequest.js"; import { BearerAuthMethod, BearerAuthMethod$Outbound, BearerAuthMethod$outboundSchema, } from "./bearerauthmethod.js"; import { NoneAuthMethod, NoneAuthMethod$Outbound, NoneAuthMethod$outboundSchema, } from "./noneauthmethod.js"; import { OAuth2AuthMethod, OAuth2AuthMethod$Outbound, OAuth2AuthMethod$outboundSchema, } from "./oauth2authmethod.js"; export type ConnectorMCPPublicUpdateAuthMethod1 = | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }); export type ConnectorMCPPublicUpdateAuthMethod2 = | AuthenticationMethodCreateOrUpdateRequest | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }); export type ConnectorMCPPublicUpdate = { /** * Optional human-readable title for the connector. */ title?: string | null | undefined; /** * The name of the connector. */ name?: string | null | undefined; /** * The description of the connector. */ description?: string | null | undefined; /** * The optional url of the icon you want to associate to the connector. */ iconUrl?: string | null | undefined; /** * New connector server URL. */ server?: string | null | undefined; /** * Authentication methods supported by the connector. */ authMethods?: | Array< | AuthenticationMethodCreateOrUpdateRequest | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }) > | null | undefined; protocol: "mcp"; /** * Optional system prompt for the connector. */ systemPrompt?: string | null | undefined; }; /** @internal */ export type ConnectorMCPPublicUpdateAuthMethod1$Outbound = | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }); /** @internal */ export const ConnectorMCPPublicUpdateAuthMethod1$outboundSchema: z.ZodType< ConnectorMCPPublicUpdateAuthMethod1$Outbound, ConnectorMCPPublicUpdateAuthMethod1 > = z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]); export function connectorMCPPublicUpdateAuthMethod1ToJSON( connectorMCPPublicUpdateAuthMethod1: ConnectorMCPPublicUpdateAuthMethod1, ): string { return JSON.stringify( ConnectorMCPPublicUpdateAuthMethod1$outboundSchema.parse( connectorMCPPublicUpdateAuthMethod1, ), ); } /** @internal */ export type ConnectorMCPPublicUpdateAuthMethod2$Outbound = | AuthenticationMethodCreateOrUpdateRequest$Outbound | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }); /** @internal */ export const ConnectorMCPPublicUpdateAuthMethod2$outboundSchema: z.ZodType< ConnectorMCPPublicUpdateAuthMethod2$Outbound, ConnectorMCPPublicUpdateAuthMethod2 > = smartUnion([ AuthenticationMethodCreateOrUpdateRequest$outboundSchema, z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]), ]); export function connectorMCPPublicUpdateAuthMethod2ToJSON( connectorMCPPublicUpdateAuthMethod2: ConnectorMCPPublicUpdateAuthMethod2, ): string { return JSON.stringify( ConnectorMCPPublicUpdateAuthMethod2$outboundSchema.parse( connectorMCPPublicUpdateAuthMethod2, ), ); } /** @internal */ export type ConnectorMCPPublicUpdate$Outbound = { title?: string | null | undefined; name?: string | null | undefined; description?: string | null | undefined; icon_url?: string | null | undefined; server?: string | null | undefined; auth_methods?: | Array< | AuthenticationMethodCreateOrUpdateRequest$Outbound | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }) > | null | undefined; protocol: "mcp"; system_prompt?: string | null | undefined; }; /** @internal */ export const ConnectorMCPPublicUpdate$outboundSchema: z.ZodType< ConnectorMCPPublicUpdate$Outbound, ConnectorMCPPublicUpdate > = z.object({ title: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), iconUrl: z.nullable(z.string()).optional(), server: z.nullable(z.string()).optional(), authMethods: z.nullable( z.array( smartUnion([ AuthenticationMethodCreateOrUpdateRequest$outboundSchema, z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]), ]), ), ).optional(), protocol: z.literal("mcp"), systemPrompt: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { iconUrl: "icon_url", authMethods: "auth_methods", systemPrompt: "system_prompt", }); }); export function connectorMCPPublicUpdateToJSON( connectorMCPPublicUpdate: ConnectorMCPPublicUpdate, ): string { return JSON.stringify( ConnectorMCPPublicUpdate$outboundSchema.parse(connectorMCPPublicUpdate), ); }