plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Client

type Client interface {
	TestApi() (string, error) // TODO: remove later
	GenerateOAuthToken(formValues url.Values) (*serializers.OAuthSuccessResponse, int, error)
	CreateTask(body *serializers.TaskCreateRequestPayload, mattermostUserID string) (*serializers.TaskValue, int, error)
	GetTask(queryParams serializers.GetTaskData, mattermostUserID string) (*serializers.TaskValue, int, error)
	Link(body *serializers.LinkRequestPayload, mattermostUserID string) (*serializers.Project, int, error)
}

func InitClient

func InitClient(p *Plugin) Client

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) Handle

func (ch *Handler) Handle(p *Plugin, c *plugin.Context, commandArgs *model.CommandArgs, args ...string) (*model.CommandResponse, *model.AppError)

TODO: add comments to explain the below code or refactor it

type HandlerFunc

type HandlerFunc func(p *Plugin, c *plugin.Context, commandArgs *model.CommandArgs, args ...string) (*model.CommandResponse, *model.AppError)

type OAuthConfig

type OAuthConfig struct {
	// contains filtered or unexported fields
}

type Plugin

type Plugin struct {
	plugin.MattermostPlugin

	Client Client

	Store *store.Store
	// contains filtered or unexported fields
}

Plugin implements the interface expected by the Mattermost server to communicate between the server and plugin processes.

func (*Plugin) AddAuthorization

func (p *Plugin) AddAuthorization(r *http.Request, mattermostUserID string) error

AddAuthorization function to add authorization to a request.

func (*Plugin) DM

func (p *Plugin) DM(mattermostUserID, format string, args ...interface{}) (string, error)

DM posts a simple Direct Message to the specified user

func (*Plugin) ExecuteCommand

func (p *Plugin) ExecuteCommand(c *plugin.Context, commandArgs *model.CommandArgs) (*model.CommandResponse, *model.AppError)

Handles executing a slash command

func (*Plugin) GenerateOAuthConnectURL

func (p *Plugin) GenerateOAuthConnectURL(mattermostUserID string) string

GenerateOAuthConnectURL generates URL for Azure OAuth authorization

func (*Plugin) GenerateOAuthToken

func (p *Plugin) GenerateOAuthToken(code, state string) error

GenerateOAuthToken generates OAuth token after successful authorization

func (*Plugin) GetPluginURL

func (p *Plugin) GetPluginURL() string

func (*Plugin) GetPluginURLPath

func (p *Plugin) GetPluginURLPath() string

func (*Plugin) GetSiteURL

func (p *Plugin) GetSiteURL() string

func (*Plugin) HandleStaticFiles

func (p *Plugin) HandleStaticFiles()

Handles the static files under the assets directory.

func (*Plugin) InitAPI

func (p *Plugin) InitAPI() *mux.Router

Initializes the plugin REST API

func (*Plugin) InitRoutes

func (p *Plugin) InitRoutes()

Add custom routes and corresponding handlers here

func (*Plugin) IsAnyProjectLinked

func (p *Plugin) IsAnyProjectLinked(mattermostUserID string) (bool, error)

func (*Plugin) IsProjectLinked

func (p *Plugin) IsProjectLinked(projectList []serializers.ProjectDetails, project serializers.ProjectDetails) bool

func (*Plugin) MessageWillBePosted

func (p *Plugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string)

func (*Plugin) OAuthComplete

func (p *Plugin) OAuthComplete(w http.ResponseWriter, r *http.Request)

OAuthComplete captures the redirection request made by the OAuth authorization

func (*Plugin) OAuthConfig

func (p *Plugin) OAuthConfig() *OAuthConfig

OAuthConfig initialize OAuth configs

func (*Plugin) OAuthConnect

func (p *Plugin) OAuthConnect(w http.ResponseWriter, r *http.Request)

OAuthConnect redirects to the OAuth authorization URL

func (*Plugin) OnActivate

func (p *Plugin) OnActivate() error

Invoked when the plugin is activated

func (*Plugin) OnConfigurationChange

func (p *Plugin) OnConfigurationChange() error

Invoked when configuration changes may have been made.

func (*Plugin) ParseAuthToken

func (p *Plugin) ParseAuthToken(encoded string) (string, error)

func (*Plugin) RefreshOAuthToken

func (p *Plugin) RefreshOAuthToken(mattermostUserID string) error

RefreshOAuthToken refreshes OAuth token

func (*Plugin) ServeHTTP

func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)

ServeHTTP demonstrates a plugin that handles HTTP requests.

func (*Plugin) StoreOAuthToken

func (p *Plugin) StoreOAuthToken(mattermostUserID string, oauthTokenFormValues url.Values) error

StoreOAuthToken stores oAuth token

func (*Plugin) UserAlreadyConnected

func (p *Plugin) UserAlreadyConnected(mattermostUserID string) bool

UserAlreadyConnected checks if a user is already connected

func (*Plugin) WithRecovery

func (p *Plugin) WithRecovery(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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