api

package
v1.26.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricChartPeriod          = 10
	MetricRollingAveragePeriod = 10
)
View Source
const SettingsKey = "global_settings"

Variables

This section is empty.

Functions

func CanStartTrialLicense

func CanStartTrialLicense(userID string, pluginAPI *pluginapi.Client) error

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

func MattermostAuthorizationRequired(next http.Handler) http.Handler

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

func NewHandler(pluginAPI *pluginapi.Client, config config.Service, log bot.Logger) *Handler

NewHandler constructs a new handler.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

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.

func NewSettingsHandler

func NewSettingsHandler(router *mux.Router, api *pluginapi.Client, log bot.Logger, configService config.Service) *SettingsHandler

NewSettingsHandler returns a new settings 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"`
}

Jump to

Keyboard shortcuts

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