/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 35421f68d7eb */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { AuthData, AuthData$Outbound, AuthData$outboundSchema, } from "./authdata.js"; import { BearerAuthMethod, BearerAuthMethod$Outbound, BearerAuthMethod$outboundSchema, } from "./bearerauthmethod.js"; import { ExtendedOAuthServerMetadata, ExtendedOAuthServerMetadata$Outbound, ExtendedOAuthServerMetadata$outboundSchema, } from "./extendedoauthservermetadata.js"; import { GlobalHeaderValue, GlobalHeaderValue$Outbound, GlobalHeaderValue$outboundSchema, } from "./globalheadervalue.js"; import { NoneAuthMethod, NoneAuthMethod$Outbound, NoneAuthMethod$outboundSchema, } from "./noneauthmethod.js"; import { OAuth2AuthMethod, OAuth2AuthMethod$Outbound, OAuth2AuthMethod$outboundSchema, } from "./oauth2authmethod.js"; import { PublicResourceVisibility, PublicResourceVisibility$outboundSchema, } from "./publicresourcevisibility.js"; export type CreateHTTPConnectorRequestAuthMethod = | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }); export type CreateHTTPConnectorRequest = { /** * Optional scoped credentials to be sent with connector requests. */ headers?: { [k: string]: any } | null | undefined; /** * Optional connector-wide headers, keyed by header name, set at creation and applied to every credential. Secret values are encrypted at rest and never returned in clear. */ globalHeaders?: { [k: string]: GlobalHeaderValue } | undefined; /** * Optional additional authentication data for the connector. */ authData?: AuthData | null | undefined; /** * Optional OAuth2 authorization server metadata (authorization_endpoint, token_endpoint, etc.). When provided, skips .well-known discovery and uses these endpoints directly. */ oauth2ServerMetadata?: ExtendedOAuthServerMetadata | null | undefined; /** * Optional URL to fetch OAuth2 authorization server metadata from (RFC 8414). When provided, the metadata is fetched from this URL and used instead of .well-known discovery. Mutually exclusive with oauth2_server_metadata. */ oauth2ServerMetadataUrl?: string | null | undefined; /** * The name of the connector. Should be 64 char length maximum, alphanumeric, only underscores/dashes. */ name: string; /** * Optional human-readable title for the connector. */ title?: string | null | undefined; /** * The description of the connector. */ description: string; /** * The optional url of the icon you want to associate to the connector. */ iconUrl?: string | null | undefined; /** * The URL of the connector server. */ server: string; /** * Connector visibility options. */ visibility?: PublicResourceVisibility | undefined; /** * Authentication methods supported by the connector. */ authMethods?: | Array< | BearerAuthMethod | NoneAuthMethod | (OAuth2AuthMethod & { methodType: "oauth2" }) > | null | undefined; /** * Optional system prompt for the connector. */ systemPrompt?: string | null | undefined; protocol: "http"; }; /** @internal */ export type CreateHTTPConnectorRequestAuthMethod$Outbound = | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }); /** @internal */ export const CreateHTTPConnectorRequestAuthMethod$outboundSchema: z.ZodType< CreateHTTPConnectorRequestAuthMethod$Outbound, CreateHTTPConnectorRequestAuthMethod > = z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]); export function createHTTPConnectorRequestAuthMethodToJSON( createHTTPConnectorRequestAuthMethod: CreateHTTPConnectorRequestAuthMethod, ): string { return JSON.stringify( CreateHTTPConnectorRequestAuthMethod$outboundSchema.parse( createHTTPConnectorRequestAuthMethod, ), ); } /** @internal */ export type CreateHTTPConnectorRequest$Outbound = { headers?: { [k: string]: any } | null | undefined; global_headers?: { [k: string]: GlobalHeaderValue$Outbound } | undefined; auth_data?: AuthData$Outbound | null | undefined; oauth2_server_metadata?: | ExtendedOAuthServerMetadata$Outbound | null | undefined; oauth2_server_metadata_url?: string | null | undefined; name: string; title?: string | null | undefined; description: string; icon_url?: string | null | undefined; server: string; visibility?: string | undefined; auth_methods?: | Array< | BearerAuthMethod$Outbound | NoneAuthMethod$Outbound | (OAuth2AuthMethod$Outbound & { method_type: "oauth2" }) > | null | undefined; system_prompt?: string | null | undefined; protocol: "http"; }; /** @internal */ export const CreateHTTPConnectorRequest$outboundSchema: z.ZodType< CreateHTTPConnectorRequest$Outbound, CreateHTTPConnectorRequest > = z.object({ headers: z.nullable(z.record(z.string(), z.any())).optional(), globalHeaders: z.record(z.string(), GlobalHeaderValue$outboundSchema) .optional(), authData: z.nullable(AuthData$outboundSchema).optional(), oauth2ServerMetadata: z.nullable(ExtendedOAuthServerMetadata$outboundSchema) .optional(), oauth2ServerMetadataUrl: z.nullable(z.string()).optional(), name: z.string(), title: z.nullable(z.string()).optional(), description: z.string(), iconUrl: z.nullable(z.string()).optional(), server: z.string(), visibility: PublicResourceVisibility$outboundSchema.optional(), authMethods: z.nullable( z.array( z.union([ BearerAuthMethod$outboundSchema, NoneAuthMethod$outboundSchema, OAuth2AuthMethod$outboundSchema.and( z.object({ methodType: z.literal("oauth2") }).transform((v) => ({ method_type: v.methodType, })), ), ]), ), ).optional(), systemPrompt: z.nullable(z.string()).optional(), protocol: z.literal("http"), }).transform((v) => { return remap$(v, { globalHeaders: "global_headers", authData: "auth_data", oauth2ServerMetadata: "oauth2_server_metadata", oauth2ServerMetadataUrl: "oauth2_server_metadata_url", iconUrl: "icon_url", authMethods: "auth_methods", systemPrompt: "system_prompt", }); }); export function createHTTPConnectorRequestToJSON( createHTTPConnectorRequest: CreateHTTPConnectorRequest, ): string { return JSON.stringify( CreateHTTPConnectorRequest$outboundSchema.parse(createHTTPConnectorRequest), ); }