{"modulePath":"github.com/txn2/mcp-data-platform","version":"v1.172.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package postshttp\n\nPackage postshttp serves the posts a managed-script run made to notification channels (#1723): the run page's list of what the run sent with platform.notify and platform.publish, and what became of each.\n\nThe posts are read from the notification queue by the run each post's document records, not from the run's outputs. An output is a file the run wrote; a post is a message, and what the person reading the run page wants to know about it is whether it arrived.\n\n## Types\n\n```go\ntype Deps struct {\n\t// Run reads the run in the path for a caller entitled to it, or writes\n\t// the refusal.\n\tRun   func(w http.ResponseWriter, r *http.Request) (*script.Run, bool)\n\tPosts PostReader\n}\n```\nDeps are the run lookup the route answers under and where the posts are read from.\n\n```go\ntype Handler struct {\n\t// contains filtered or unexported fields\n}\n```\nHandler serves the route.\n\n```go\nfunc ForPortal(scripts *scripthttp.Handler, deps scripthttp.Deps, posts PostReader) *Handler\n```\nForPortal builds the route over the script routes' own run lookup, so a run is found, and refused, the way every other run route finds it: readable by the script's owner, an administrator, and whoever requested the run.\n\n```go\nfunc New(deps Deps) *Handler\n```\nNew builds the handler from its dependencies.\n\n```go\nfunc (h *Handler) Register(mux *http.ServeMux, wrap func(http.Handler) http.Handler)\n```\nRegister mounts the route, wrapped in the portal authentication middleware. A nil handler mounts nothing.\n\n```go\ntype Post struct {\n\tChannel  string    `json:\"channel\" example:\"ops-alerts\"`\n\tTitle    string    `json:\"title\" example:\"Orders feed is 41 minutes behind\"`\n\tQueuedAt time.Time `json:\"queued_at\"`\n\t// Status is sent when every delivery went out, failed when any gave up,\n\t// and queued while any is still waiting.\n\tStatus string `json:\"status\" example:\"sent\"`\n\t// Deliveries counts what the post became: one for a chat or webhook\n\t// channel, one per recipient for an email channel.\n\tDeliveries int        `json:\"deliveries\" example:\"1\"`\n\tSent       int        `json:\"sent\" example:\"1\"`\n\tFailed     int        `json:\"failed\" example:\"0\"`\n\tSentAt     *time.Time `json:\"sent_at,omitempty\"`\n\tLastError  string     `json:\"last_error,omitempty\" example:\"upstream answered HTTP 403\"`\n\t// OptedOut is how many of an email channel's recipients were not sent\n\t// the post because they turned email notifications off (#2743); the run\n\t// page states it beside the deliveries.\n\tOptedOut int `json:\"opted_out\" example:\"0\"`\n}\n```\nPost is one post as the run page shows it.\n\n```go\ntype PostReader interface {\n\tRunPosts(ctx context.Context, runID string) ([]notification.RunPost, error)\n}\n```\nPostReader reads one run's posts. notifyqueue.PostgresStore implements it.\n\n","path":"github.com/txn2/mcp-data-platform/internal/httpserver/scripthttp/postshttp","name":"postshttp","synopsis":"Package postshttp serves the posts a managed-script run made to notification channels (#1723): the run page's list of what the run sent with platform.notify and platform.publish, and what became of each.","isRedistributable":true}
