/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 4a11f558de21 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { AuthData, AuthData$Outbound, AuthData$outboundSchema, } from "./authdata.js"; import { ConnectorAuthenticationHeader, ConnectorAuthenticationHeader$Outbound, ConnectorAuthenticationHeader$outboundSchema, } from "./connectorauthenticationheader.js"; import { ExtendedOAuthServerMetadata, ExtendedOAuthServerMetadata$Outbound, ExtendedOAuthServerMetadata$outboundSchema, } from "./extendedoauthservermetadata.js"; export type OAuth2AuthorizationCodeAuthMethod = { methodType?: "oauth2" | undefined; /** * Custom superset of RFC 8414 OAuth 2.0 Authorization Server Metadata. * * @remarks * * Stored at connector creation time (provided for HTTP connectors, discovered via .well-known for MCP). * Mirrors the shape of .well-known/oauth-authorization-server responses. */ oauth2ServerMetadata: ExtendedOAuthServerMetadata; /** * Optional headers sent with requests for this auth method. */ headers?: Array | null | undefined; grantType: "authorization_code"; authData: AuthData; }; /** @internal */ export type OAuth2AuthorizationCodeAuthMethod$Outbound = { method_type: "oauth2"; oauth2_server_metadata: ExtendedOAuthServerMetadata$Outbound; headers?: Array | null | undefined; grant_type: "authorization_code"; auth_data: AuthData$Outbound; }; /** @internal */ export const OAuth2AuthorizationCodeAuthMethod$outboundSchema: z.ZodType< OAuth2AuthorizationCodeAuthMethod$Outbound, OAuth2AuthorizationCodeAuthMethod > = z.object({ methodType: z.literal("oauth2").default("oauth2" as const), oauth2ServerMetadata: ExtendedOAuthServerMetadata$outboundSchema, headers: z.nullable(z.array(ConnectorAuthenticationHeader$outboundSchema)) .optional(), grantType: z.literal("authorization_code"), authData: AuthData$outboundSchema, }).transform((v) => { return remap$(v, { methodType: "method_type", oauth2ServerMetadata: "oauth2_server_metadata", grantType: "grant_type", authData: "auth_data", }); }); export function oAuth2AuthorizationCodeAuthMethodToJSON( oAuth2AuthorizationCodeAuthMethod: OAuth2AuthorizationCodeAuthMethod, ): string { return JSON.stringify( OAuth2AuthorizationCodeAuthMethod$outboundSchema.parse( oAuth2AuthorizationCodeAuthMethod, ), ); }