{"modulePath":"github.com/txn2/mcp-data-platform","version":"v1.172.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package channelhttp\n\nPackage channelhttp serves the portal's channel routes: the channels the signed-in person can reach with their bots' chat channels, sharing an asset to one from the Share dialog (#2241), and sending a message to one (#1723).\n\nEvery route is a notify tool call, made over an in-memory session that authenticates as the person the portal signed in. That is the whole point of the shape: who may reach a channel, what an asset becomes when it is posted, the per-session rate limit and the audit row are the tool's, so the asset page and an agent asking for the same post cannot come to disagree about any of them.\n\n## Functions\n\n```go\nfunc SharingFor(reg *persona.Registry, adminPersona string) func(*access.User) bool\n```\nSharingFor answers whether a portal user's persona lets them share (#2241): the persona their roles resolve to allows it, or is the admin persona. A user whose roles resolve to no persona shares nothing. nil with no registry, which allows everyone.\n\n## Types\n\n```go\ntype API struct {\n\t// Server is the assembled MCP server the calls are made against. nil\n\t// answers every route 503.\n\tServer *mcp.Server\n\t// SharingAllowed reports whether the signed-in person's persona lets\n\t// them share (#2241). The channel list and the channel share refuse\n\t// without it. nil allows everyone.\n\tSharingAllowed func(*access.User) bool\n}\n```\nAPI serves the routes.\n\n```go\nfunc (a *API) CallAs(w http.ResponseWriter, r *http.Request, user *access.User, args map[string]any) bool\n```\nCallAs issues one notify call as user and writes what the tool answered, reporting whether the post went out: a file posted to a channel withdraws the share it made when it did not (#2258).\n\n```go\nfunc (a *API) Register(mux *http.ServeMux)\n```\nRegister mounts the routes on the portal's authenticated mux.\n\n```go\ntype ChannelShareRequest struct {\n\t// Channel is the channel's name, as the list reports it.\n\tChannel string `json:\"channel\" example:\"slack\"`\n\t// Target is the chat channel of a slack or mattermost channel, one of\n\t// the ids the list reports under the channel's targets. Empty posts to\n\t// the channel's own.\n\tTarget string `json:\"target,omitempty\" example:\"C0123456789\"`\n\t// AccessMode is who opens the posted link: authenticated (any signed-in\n\t// user, no expiration) or public (anyone with the link, expires_in\n\t// required).\n\tAccessMode string `json:\"access_mode\" example:\"authenticated\" enums:\"authenticated,public\"`\n\t// ExpiresIn is the public link's lifetime, a duration such as 168h.\n\tExpiresIn string `json:\"expires_in,omitempty\" example:\"168h\"`\n\t// Message is an optional line posted above the asset.\n\tMessage string `json:\"message,omitempty\" example:\"This week's numbers\"`\n}\n```\nChannelShareRequest shares an asset to a channel (#2241).\n\n```go\ntype SendRequest struct {\n\tTitle string `json:\"title\" example:\"Nightly load finished late\"`\n\t// Body is markdown.\n\tBody string `json:\"body,omitempty\" example:\"The load finished at 06:40, forty minutes past its window.\"`\n\t// Link is the absolute URL a reader follows from the message.\n\tLink string `json:\"link,omitempty\" example:\"https://platform.example.com/portal/automations/scr_1/runs/run_9\"`\n}\n```\nSendRequest posts a message.\n\n","path":"github.com/txn2/mcp-data-platform/internal/httpserver/channelhttp","name":"channelhttp","synopsis":"Package channelhttp serves the portal's channel routes: the channels the signed-in person can reach with their bots' chat channels, sharing an asset to one from the Share dialog (#2241), and sending a message to one (#1723).","isRedistributable":true}
