/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: fc1ddf9da848 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { ConnectorAuthenticationHeader, ConnectorAuthenticationHeader$Outbound, ConnectorAuthenticationHeader$outboundSchema, } from "./connectorauthenticationheader.js"; import { ExtendedOAuthServerMetadata, ExtendedOAuthServerMetadata$Outbound, ExtendedOAuthServerMetadata$outboundSchema, } from "./extendedoauthservermetadata.js"; import { OAuth2TokenEndpointAuthMethod, OAuth2TokenEndpointAuthMethod$outboundSchema, } from "./oauth2tokenendpointauthmethod.js"; export type OAuth2ClientCredentialsAuthMethod = { 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: "client_credentials"; tokenEndpointAuthMethod: OAuth2TokenEndpointAuthMethod; }; /** @internal */ export type OAuth2ClientCredentialsAuthMethod$Outbound = { method_type: "oauth2"; oauth2_server_metadata: ExtendedOAuthServerMetadata$Outbound; headers?: Array | null | undefined; grant_type: "client_credentials"; token_endpoint_auth_method: string; }; /** @internal */ export const OAuth2ClientCredentialsAuthMethod$outboundSchema: z.ZodType< OAuth2ClientCredentialsAuthMethod$Outbound, OAuth2ClientCredentialsAuthMethod > = z.object({ methodType: z.literal("oauth2").default("oauth2" as const), oauth2ServerMetadata: ExtendedOAuthServerMetadata$outboundSchema, headers: z.nullable(z.array(ConnectorAuthenticationHeader$outboundSchema)) .optional(), grantType: z.literal("client_credentials"), tokenEndpointAuthMethod: OAuth2TokenEndpointAuthMethod$outboundSchema, }).transform((v) => { return remap$(v, { methodType: "method_type", oauth2ServerMetadata: "oauth2_server_metadata", grantType: "grant_type", tokenEndpointAuthMethod: "token_endpoint_auth_method", }); }); export function oAuth2ClientCredentialsAuthMethodToJSON( oAuth2ClientCredentialsAuthMethod: OAuth2ClientCredentialsAuthMethod, ): string { return JSON.stringify( OAuth2ClientCredentialsAuthMethod$outboundSchema.parse( oAuth2ClientCredentialsAuthMethod, ), ); }