Documentation ¶
Index ¶
- Constants
- Variables
- 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 CategoryHandler
- type ChecklistItemResolver
- type ChecklistResolver
- type Context
- type ErrorHandler
- type GraphQLHandler
- type Handler
- type MetadataResolver
- type MetricConfigResolver
- type PlaybookHandler
- type PlaybookResolver
- func (r *PlaybookResolver) Checklists() []*ChecklistResolver
- func (r *PlaybookResolver) DeleteAt() float64
- func (r *PlaybookResolver) IsFavorite(ctx context.Context) (bool, error)
- func (r *PlaybookResolver) Metrics() []*MetricConfigResolver
- func (r *PlaybookResolver) ReminderTimerDefaultSeconds() float64
- func (r *PlaybookResolver) RetrospectiveReminderIntervalSeconds() float64
- type PlaybookRunHandler
- type PlaybookSiteStats
- type PlaybookStats
- type RootResolver
- func (r *RootResolver) AddMetric(ctx context.Context, args struct{ ... }) (string, error)
- func (r *RootResolver) AddPlaybookMember(ctx context.Context, args struct{ ... }) (string, error)
- func (r *RootResolver) DeleteMetric(ctx context.Context, args struct{ ... }) (string, error)
- func (r *RootResolver) Playbook(ctx context.Context, args struct{ ... }) (*PlaybookResolver, error)
- func (r *RootResolver) Playbooks(ctx context.Context, args struct{ ... }) ([]*PlaybookResolver, error)
- func (r *RootResolver) RemovePlaybookMember(ctx context.Context, args struct{ ... }) (string, error)
- func (r *RootResolver) Run(ctx context.Context, args struct{ ... }) (*RunResolver, error)
- func (r *RootResolver) Runs(ctx context.Context, args struct{ ... }) ([]*RunResolver, error)
- func (r *RootResolver) UpdateMetric(ctx context.Context, args struct{ ... }) (string, error)
- func (r *RootResolver) UpdatePlaybook(ctx context.Context, args struct{ ... }) (string, error)
- func (r *RootResolver) UpdateRun(ctx context.Context, args struct{ ... }) (string, error)
- type RunResolver
- type SettingsHandler
- type SignalHandler
- type StatsHandler
- type TelemetryHandler
- type TrackerPayload
- type UpdateChecklist
- type UpdateChecklistItem
Constants ¶
const ( MetricChartPeriod = 10 MetricRollingAveragePeriod = 10 )
const MaxRequestSize = 5 * 1024 * 1024 // 5MB
MaxRequestSize is the size limit for any incoming request The default limit set by mattermost-server is the configured max file size, and it sometimes isn't small enough to prevent some scenarios.
This is important to prevent huge payloads from being sent that could end in a bigger problem.
If an endpoint needs a smaller limit than this one, it could be solved by adding their own limit BEFORE reading the request body `r.Body = http.MaxBytesReader(w, r.Body, MaxRequestSize)`
const SettingsKey = "global_settings"
Variables ¶
var GraphiqlPage []byte
var SchemaFile string
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 CategoryHandler ¶ added in v1.31.0
type CategoryHandler struct { *ErrorHandler // contains filtered or unexported fields }
func NewCategoryHandler ¶ added in v1.31.0
func NewCategoryHandler(router *mux.Router, api *pluginapi.Client, logger bot.Logger, categoryService app.CategoryService, playbookService app.PlaybookService, playbookRunService app.PlaybookRunService) *CategoryHandler
type ChecklistItemResolver ¶ added in v1.28.0
type ChecklistItemResolver struct {
app.ChecklistItem
}
func (*ChecklistItemResolver) AssigneeModified ¶ added in v1.28.0
func (r *ChecklistItemResolver) AssigneeModified() float64
func (*ChecklistItemResolver) CommandLastRun ¶ added in v1.28.0
func (r *ChecklistItemResolver) CommandLastRun() float64
func (*ChecklistItemResolver) DueDate ¶ added in v1.28.0
func (r *ChecklistItemResolver) DueDate() float64
func (*ChecklistItemResolver) StateModified ¶ added in v1.28.0
func (r *ChecklistItemResolver) StateModified() float64
type ChecklistResolver ¶ added in v1.28.0
func (*ChecklistResolver) Items ¶ added in v1.28.0
func (r *ChecklistResolver) Items() []*ChecklistItemResolver
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 GraphQLHandler ¶ added in v1.28.0
type GraphQLHandler struct { *ErrorHandler // contains filtered or unexported fields }
func NewGraphQLHandler ¶ added in v1.28.0
func NewGraphQLHandler( router *mux.Router, playbookService app.PlaybookService, playbookRunService app.PlaybookRunService, categoryService app.CategoryService, api *pluginapi.Client, log bot.Logger, configService config.Service, permissions *app.PermissionsService, playbookStore app.PlaybookStore, licenceChecker app.LicenseChecker, ) *GraphQLHandler
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 MetadataResolver ¶ added in v1.32.1
type MetricConfigResolver ¶ added in v1.28.0
type MetricConfigResolver struct {
app.PlaybookMetricConfig
}
func (*MetricConfigResolver) Target ¶ added in v1.28.0
func (r *MetricConfigResolver) Target() *int32
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 PlaybookResolver ¶ added in v1.28.0
func (*PlaybookResolver) Checklists ¶ added in v1.28.0
func (r *PlaybookResolver) Checklists() []*ChecklistResolver
func (*PlaybookResolver) DeleteAt ¶ added in v1.28.0
func (r *PlaybookResolver) DeleteAt() float64
func (*PlaybookResolver) IsFavorite ¶ added in v1.31.0
func (r *PlaybookResolver) IsFavorite(ctx context.Context) (bool, error)
func (*PlaybookResolver) Metrics ¶ added in v1.28.0
func (r *PlaybookResolver) Metrics() []*MetricConfigResolver
func (*PlaybookResolver) ReminderTimerDefaultSeconds ¶ added in v1.28.0
func (r *PlaybookResolver) ReminderTimerDefaultSeconds() float64
func (*PlaybookResolver) RetrospectiveReminderIntervalSeconds ¶ added in v1.28.0
func (r *PlaybookResolver) RetrospectiveReminderIntervalSeconds() float64
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 PlaybookSiteStats ¶ added in v1.28.0
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 []null.Int `json:"metric_overall_average"` MetricRollingAverage []null.Int `json:"metric_rolling_average"` MetricRollingAverageChange []null.Int `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 RootResolver ¶ added in v1.28.0
type RootResolver struct{}
func (*RootResolver) AddPlaybookMember ¶ added in v1.31.0
func (*RootResolver) DeleteMetric ¶ added in v1.28.0
func (*RootResolver) Playbook ¶ added in v1.28.0
func (r *RootResolver) Playbook(ctx context.Context, args struct { ID string }) (*PlaybookResolver, error)
func (*RootResolver) RemovePlaybookMember ¶ added in v1.31.0
func (*RootResolver) Run ¶ added in v1.32.1
func (r *RootResolver) Run(ctx context.Context, args struct { ID string `url:"id,omitempty"` }) (*RunResolver, error)
func (*RootResolver) Runs ¶ added in v1.31.0
func (r *RootResolver) Runs(ctx context.Context, args struct { TeamID string `url:"team_id,omitempty"` Sort string Statuses []string ParticipantOrFollowerID string `url:"participant_or_follower,omitempty"` }) ([]*RunResolver, error)
func (*RootResolver) UpdateMetric ¶ added in v1.28.0
func (*RootResolver) UpdatePlaybook ¶ added in v1.28.0
func (r *RootResolver) UpdatePlaybook(ctx context.Context, args struct { ID string Updates struct { Title *string Description *string Public *bool CreatePublicPlaybookRun *bool ReminderMessageTemplate *string ReminderTimerDefaultSeconds *float64 StatusUpdateEnabled *bool InvitedUserIDs *[]string InvitedGroupIDs *[]string InviteUsersEnabled *bool DefaultOwnerID *string DefaultOwnerEnabled *bool BroadcastChannelIDs *[]string BroadcastEnabled *bool WebhookOnCreationURLs *[]string WebhookOnCreationEnabled *bool MessageOnJoin *string MessageOnJoinEnabled *bool RetrospectiveReminderIntervalSeconds *float64 RetrospectiveTemplate *string RetrospectiveEnabled *bool WebhookOnStatusUpdateURLs *[]string WebhookOnStatusUpdateEnabled *bool SignalAnyKeywords *[]string SignalAnyKeywordsEnabled *bool CategorizeChannelEnabled *bool CategoryName *string RunSummaryTemplateEnabled *bool RunSummaryTemplate *string ChannelNameTemplate *string Checklists *[]UpdateChecklist IsFavorite *bool } }) (string, error)
type RunResolver ¶ added in v1.31.0
type RunResolver struct {
app.PlaybookRun
}
func (*RunResolver) IsFavorite ¶ added in v1.31.0
func (r *RunResolver) IsFavorite(ctx context.Context) (bool, error)
func (*RunResolver) Metadata ¶ added in v1.32.1
func (r *RunResolver) Metadata(ctx context.Context) (*MetadataResolver, error)
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"`
}
type UpdateChecklist ¶ added in v1.28.0
type UpdateChecklist struct { Title string `json:"title"` Items []UpdateChecklistItem `json:"items"` }
type UpdateChecklistItem ¶ added in v1.28.0
type UpdateChecklistItem struct { Title string `json:"title"` State string `json:"state"` StateModified float64 `json:"state_modified"` AssigneeID string `json:"assignee_id"` AssigneeModified float64 `json:"assignee_modified"` Command string `json:"command"` CommandLastRun float64 `json:"command_last_run"` Description string `json:"description"` LastSkipped float64 `json:"delete_at"` DueDate float64 `json:"due_date"` }