Documentation ¶
Index ¶
- Constants
- func CanStartTrialLicense(userID string, pluginAPI *pluginapi.Client) error
- func HandleErrorWithCode(logger bot.Logger, w http.ResponseWriter, code int, publicErrorMsg string, ...)
- func MattermostAuthorizationRequired(next http.Handler) http.Handler
- func ReturnJSON(w http.ResponseWriter, pointerToObject interface{}, httpStatus int)
- type ActionsHandler
- type BotHandler
- type ErrorHandler
- type Handler
- type PlaybookHandler
- type PlaybookRunHandler
- type PlaybookStats
- type SettingsHandler
- type SignalHandler
- type StatsHandler
- type TelemetryHandler
- type TrackerPayload
Constants ¶
const ( MetricChartPeriod = 10 MetricRollingAveragePeriod = 10 )
const SettingsKey = "global_settings"
Variables ¶
This section is empty.
Functions ¶
func CanStartTrialLicense ¶
func HandleErrorWithCode ¶
func HandleErrorWithCode(logger bot.Logger, w http.ResponseWriter, code int, publicErrorMsg string, internalErr error)
HandleErrorWithCode logs the internal error and sends the public facing error message as JSON in a response with the provided code.
func MattermostAuthorizationRequired ¶
MattermostAuthorizationRequired checks if request is authorized.
func ReturnJSON ¶
func ReturnJSON(w http.ResponseWriter, pointerToObject interface{}, httpStatus int)
ReturnJSON writes the given pointerToObject as json with the provided httpStatus
Types ¶
type ActionsHandler ¶ added in v1.26.0
type ActionsHandler struct { *ErrorHandler // contains filtered or unexported fields }
func NewActionsHandler ¶ added in v1.26.0
func NewActionsHandler(router *mux.Router, log bot.Logger, channelActionsService app.ChannelActionService, pluginAPI *pluginapi.Client, permissions *app.PermissionsService) *ActionsHandler
type BotHandler ¶
type BotHandler struct { *ErrorHandler // contains filtered or unexported fields }
func NewBotHandler ¶
func NewBotHandler(router *mux.Router, api *pluginapi.Client, poster bot.Poster, logger bot.Logger, config config.Service, playbookRunService app.PlaybookRunService, userInfoStore app.UserInfoStore) *BotHandler
type ErrorHandler ¶
type ErrorHandler struct {
// contains filtered or unexported fields
}
func (*ErrorHandler) HandleError ¶
func (h *ErrorHandler) HandleError(w http.ResponseWriter, internalErr error)
HandleError logs the internal error and sends a generic error as JSON in a 500 response.
func (*ErrorHandler) HandleErrorWithCode ¶
func (h *ErrorHandler) HandleErrorWithCode(w http.ResponseWriter, code int, publicErrorMsg string, internalErr error)
HandleErrorWithCode logs the internal error and sends the public facing error message as JSON in a response with the provided code.
func (*ErrorHandler) PermissionsCheck ¶
func (h *ErrorHandler) PermissionsCheck(w http.ResponseWriter, checkOutput error) bool
PermissionsCheck handles the output of a permisions check Automatically does the proper error handling. Returns true if the check passed and false on failure. Correct use is: if !h.PermissionsCheck(w, check) { return }
type Handler ¶
type Handler struct { *ErrorHandler APIRouter *mux.Router // contains filtered or unexported fields }
Handler Root API handler.
func NewHandler ¶
NewHandler constructs a new handler.
type PlaybookHandler ¶
type PlaybookHandler struct { *ErrorHandler // contains filtered or unexported fields }
PlaybookHandler is the API handler.
func NewPlaybookHandler ¶
func NewPlaybookHandler(router *mux.Router, playbookService app.PlaybookService, api *pluginapi.Client, log bot.Logger, configService config.Service, permissions *app.PermissionsService) *PlaybookHandler
NewPlaybookHandler returns a new playbook api handler
type PlaybookRunHandler ¶
type PlaybookRunHandler struct { *ErrorHandler // contains filtered or unexported fields }
PlaybookRunHandler is the API handler.
func NewPlaybookRunHandler ¶
func NewPlaybookRunHandler( router *mux.Router, playbookRunService app.PlaybookRunService, playbookService app.PlaybookService, permissions *app.PermissionsService, licenseChecker app.LicenseChecker, api *pluginapi.Client, poster bot.Poster, log bot.Logger, configService config.Service, ) *PlaybookRunHandler
NewPlaybookRunHandler Creates a new Plugin API handler.
type PlaybookStats ¶
type PlaybookStats struct { RunsInProgress int `json:"runs_in_progress"` ParticipantsActive int `json:"participants_active"` RunsFinishedPrev30Days int `json:"runs_finished_prev_30_days"` RunsFinishedPercentageChange int `json:"runs_finished_percentage_change"` RunsStartedPerWeek []int `json:"runs_started_per_week"` RunsStartedPerWeekTimes [][]int64 `json:"runs_started_per_week_times"` ActiveRunsPerDay []int `json:"active_runs_per_day"` ActiveRunsPerDayTimes [][]int64 `json:"active_runs_per_day_times"` ActiveParticipantsPerDay []int `json:"active_participants_per_day"` ActiveParticipantsPerDayTimes [][]int64 `json:"active_participants_per_day_times"` MetricOverallAverage []int64 `json:"metric_overall_average"` MetricRollingAverage []int64 `json:"metric_rolling_average"` MetricRollingAverageChange []int64 `json:"metric_rolling_average_change"` MetricValueRange [][]int64 `json:"metric_value_range"` MetricRollingValues [][]int64 `json:"metric_rolling_values"` LastXRunNames []string `json:"last_x_run_names"` }
type SettingsHandler ¶
type SettingsHandler struct { *ErrorHandler // contains filtered or unexported fields }
SettingsHandler is the API handler.
type SignalHandler ¶
type SignalHandler struct { *ErrorHandler // contains filtered or unexported fields }
func NewSignalHandler ¶
func NewSignalHandler(router *mux.Router, api *pluginapi.Client, logger bot.Logger, playbookRunService app.PlaybookRunService, playbookService app.PlaybookService, keywordsThreadIgnorer app.KeywordsThreadIgnorer) *SignalHandler
type StatsHandler ¶
type StatsHandler struct { *ErrorHandler // contains filtered or unexported fields }
func NewStatsHandler ¶
func NewStatsHandler(router *mux.Router, api *pluginapi.Client, log bot.Logger, statsStore *sqlstore.StatsStore, playbookService app.PlaybookService, permissions *app.PermissionsService, licenseChecker app.LicenseChecker) *StatsHandler
type TelemetryHandler ¶
type TelemetryHandler struct { *ErrorHandler // contains filtered or unexported fields }
TelemetryHandler is the API handler.
func NewTelemetryHandler ¶
func NewTelemetryHandler( router *mux.Router, playbookRunService app.PlaybookRunService, api *pluginapi.Client, log bot.Logger, playbookRunTelemetry app.PlaybookRunTelemetry, playbookService app.PlaybookService, playbookTelemetry app.PlaybookTelemetry, botTelemetry bot.Telemetry, permissions *app.PermissionsService, ) *TelemetryHandler
NewTelemetryHandler Creates a new Plugin API handler.
type TrackerPayload ¶
type TrackerPayload struct {
Action string `json:"action"`
}