api

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextPostKey    = "post"
	ContextChannelKey = "channel"
	ContextBotKey     = "bot"
)
View Source
const (
	TitleThreadSummary     = "Thread Summary"
	TitleSummarizeUnreads  = "Summarize Unreads"
	TitleSummarizeChannel  = "Summarize Channel"
	TitleFindActionItems   = "Find Action Items"
	TitleFindOpenQuestions = "Find Open Questions"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AIBotInfo

type AIBotInfo struct {
	ID                 string                 `json:"id"`
	DisplayName        string                 `json:"displayName"`
	Username           string                 `json:"username"`
	LastIconUpdate     int64                  `json:"lastIconUpdate"`
	DMChannelID        string                 `json:"dmChannelID"`
	ChannelAccessLevel llm.ChannelAccessLevel `json:"channelAccessLevel"`
	ChannelIDs         []string               `json:"channelIDs"`
	UserAccessLevel    llm.UserAccessLevel    `json:"userAccessLevel"`
	UserIDs            []string               `json:"userIDs"`
}

type AIBotsResponse

type AIBotsResponse struct {
	Bots             []AIBotInfo `json:"bots"`
	SearchEnabled    bool        `json:"searchEnabled"`
	AllowUnsafeLinks bool        `json:"allowUnsafeLinks"`
}

type API

type API struct {
	// contains filtered or unexported fields
}

API represents the HTTP API functionality for the plugin

func New

func New(
	bots *bots.MMBots,
	conversationsService *conversations.Conversations,
	meetingsService *meetings.Service,
	indexerService *indexer.Indexer,
	searchService *search.Search,
	pluginAPI *pluginapi.Client,
	metricsService metrics.Metrics,
	llmContextBuilder *llmcontext.Builder,
	config Config,
	prompts *llm.Prompts,
	mmClient mmapi.Client,
	dbClient *mmapi.DBClient,
	licenseChecker *enterprise.LicenseChecker,
	streamingService streaming.Service,
	i18nBundle *i18n.Bundle,
	mcpClientManager MCPClientManager,
	mcpHandlers *mcpserver.PluginMCPHandlers,
	llmUpstreamHTTPClient *http.Client,
) *API

New creates a new API instance

func (*API) MattermostAuthorizationRequired

func (a *API) MattermostAuthorizationRequired(c *gin.Context)

func (*API) ServeHTTP

func (a *API) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)

ServeHTTP handles HTTP requests to the plugin

func (*API) ServeMetrics

func (a *API) ServeMetrics(c *plugin.Context, w http.ResponseWriter, r *http.Request)

ServeMetrics serves the metrics endpoint

type ClearMCPToolsCacheResponse added in v1.5.0

type ClearMCPToolsCacheResponse struct {
	ClearedServers int    `json:"cleared_servers"`
	Message        string `json:"message"`
}

ClearMCPToolsCacheResponse represents the response for clearing the cache

type Config

type Config interface {
	GetDefaultBotName() string
	MCP() mcp.Config
	AllowUnsafeLinks() bool
}

type FetchModelsRequest added in v1.7.0

type FetchModelsRequest struct {
	ServiceType string `json:"serviceType"`
	APIKey      string `json:"apiKey"`
	APIURL      string `json:"apiURL"`
	OrgID       string `json:"orgID"`
}

type MCPClientManager added in v1.4.0

type MCPClientManager interface {
	GetOAuthManager() *mcp.OAuthManager
	GetToolsCache() *mcp.ToolsCache
	GetHTTPClient() *http.Client
	ProcessOAuthCallback(ctx context.Context, loggedInUserID, state, code string) (*mcp.OAuthSession, error)
	GetEmbeddedServer() mcp.EmbeddedMCPServer
	EnsureMCPSessionID(userID string) (string, error)
}

type MCPServerInfo added in v1.4.0

type MCPServerInfo struct {
	Name        string        `json:"name"`
	URL         string        `json:"url"`
	Tools       []MCPToolInfo `json:"tools"`
	NeethsOAuth bool          `json:"needsOAuth"`
	OAuthURL    string        `json:"oauthURL,omitempty"` // URL to redirect for OAuth if needed
	Error       *string       `json:"error"`
}

MCPServerInfo represents a server and its tools for API response

type MCPToolInfo added in v1.4.0

type MCPToolInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	InputSchema any    `json:"inputSchema"`
}

MCPToolInfo represents a tool from an MCP server for API response

type MCPToolsResponse added in v1.4.0

type MCPToolsResponse struct {
	Servers []MCPServerInfo `json:"servers"`
}

MCPToolsResponse represents the response structure for MCP tools endpoint

type SearchRequest

type SearchRequest struct {
	Query      string `json:"query"`
	TeamID     string `json:"teamId"`
	ChannelID  string `json:"channelId"`
	MaxResults int    `json:"maxResults"`
}

SearchRequest represents a search query request from the API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL