Documentation ¶
Index ¶
- Variables
- type Client
- type ErrorResponse
- type Handler
- type HandlerFunc
- type OAuthConfig
- type Plugin
- func (p *Plugin) AddAuthorization(r *http.Request, mattermostUserID string) error
- func (p *Plugin) CloseBrowserWindowWithHTTPResponse(w http.ResponseWriter)
- func (p *Plugin) DM(mattermostUserID, format string, isSlackAttachment bool, args ...interface{}) (string, error)
- func (p *Plugin) Decode(encoded string) ([]byte, error)
- func (p *Plugin) Decrypt(encrypted, secret []byte) ([]byte, error)
- func (p *Plugin) Encode(encrypted []byte) string
- func (p *Plugin) Encrypt(plain, secret []byte) ([]byte, error)
- func (p *Plugin) ExecuteCommand(c *plugin.Context, commandArgs *model.CommandArgs) (*model.CommandResponse, *model.AppError)
- func (p *Plugin) GenerateAndStoreOAuthToken(mattermostUserID string, oauthTokenFormValues url.Values) error
- func (p *Plugin) GenerateOAuthConnectURL(mattermostUserID string) string
- func (p *Plugin) GenerateOAuthToken(code, state string) error
- func (p *Plugin) GetOffsetAndLimitFromQueryParams(r *http.Request) (offset, limit int)
- func (p *Plugin) GetPluginURL() string
- func (p *Plugin) GetPluginURLPath() string
- func (p *Plugin) GetSiteURL() string
- func (p *Plugin) GetSubscriptionsForAccessibleChannelsOrProjects(subscriptionList []*serializers.SubscriptionDetails, ...) ([]*serializers.SubscriptionDetails, error)
- func (p *Plugin) HandleStaticFiles()
- func (p *Plugin) InitAPI() *mux.Router
- func (p *Plugin) InitRoutes()
- func (p *Plugin) IsAccessTokenExpired(mattermostUserID string) (bool, string)
- func (p *Plugin) IsAnyProjectLinked(mattermostUserID string) (bool, error)
- func (p *Plugin) IsProjectLinked(projectList []serializers.ProjectDetails, project serializers.ProjectDetails) (*serializers.ProjectDetails, bool)
- func (p *Plugin) IsSubscriptionPresent(subscriptionList []*serializers.SubscriptionDetails, ...) (*serializers.SubscriptionDetails, bool)
- func (p *Plugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string)
- func (p *Plugin) OAuthComplete(w http.ResponseWriter, r *http.Request)
- func (p *Plugin) OAuthConfig() *OAuthConfig
- func (p *Plugin) OAuthConnect(w http.ResponseWriter, r *http.Request)
- func (p *Plugin) OnActivate() error
- func (p *Plugin) OnConfigurationChange() error
- func (p *Plugin) ParseAuthToken(encoded string) (string, error)
- func (p *Plugin) ParseSubscriptionsToCommandResponse(subscriptionsList []*serializers.SubscriptionDetails, ...) string
- func (p *Plugin) PostTaskPreview(linkData []string, userID, channelID string) (*model.Post, string)
- func (p *Plugin) RefreshOAuthToken(mattermostUserID, refreshToken string) error
- func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)
- func (p *Plugin) UserAlreadyConnected(mattermostUserID string) bool
- func (p *Plugin) WithRecovery(next http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { GenerateOAuthToken(encodedFormValues url.Values) (*serializers.OAuthSuccessResponse, int, error) CreateTask(body *serializers.CreateTaskRequestPayload, mattermostUserID string) (*serializers.TaskValue, int, error) GetTask(organization, taskID, mattermostUserID string) (*serializers.TaskValue, int, error) Link(body *serializers.LinkRequestPayload, mattermostUserID string) (*serializers.Project, int, error) CreateSubscription(body *serializers.CreateSubscriptionRequestPayload, project *serializers.ProjectDetails, channelID, pluginURL, mattermostUserID string) (*serializers.SubscriptionValue, int, error) DeleteSubscription(organization, subscriptionID, mattermostUserID string) (int, error) CheckIfUserIsProjectAdmin(organizationName, projectID, pluginURL, mattermostUserID string) (int, error) }
func InitClient ¶
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)
Handle function calls the respective handlers of the commands. It checks whether any HandlerFunc is present for the given command by checking in the "azureDevopsCommandHandler". If the command is present, it calls its handler function, else calls the default handler.
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.KVStore // 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 ¶
AddAuthorization function to add authorization to a request.
func (*Plugin) CloseBrowserWindowWithHTTPResponse ¶ added in v1.0.0
func (p *Plugin) CloseBrowserWindowWithHTTPResponse(w http.ResponseWriter)
CloseBrowserWindowWithHTTPResponse closes the browser window
func (*Plugin) DM ¶
func (p *Plugin) DM(mattermostUserID, format string, isSlackAttachment bool, 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) GenerateAndStoreOAuthToken ¶ added in v0.2.1
func (p *Plugin) GenerateAndStoreOAuthToken(mattermostUserID string, oauthTokenFormValues url.Values) error
GenerateAndStoreOAuthToken generates and stores OAuth token
func (*Plugin) GenerateOAuthConnectURL ¶
GenerateOAuthConnectURL generates URL for Azure OAuth authorization
func (*Plugin) GenerateOAuthToken ¶
GenerateOAuthToken generates OAuth token after successful authorization
func (*Plugin) GetOffsetAndLimitFromQueryParams ¶ added in v1.1.0
func (*Plugin) GetPluginURL ¶
func (*Plugin) GetPluginURLPath ¶
func (*Plugin) GetSiteURL ¶
func (*Plugin) GetSubscriptionsForAccessibleChannelsOrProjects ¶ added in v1.3.0
func (p *Plugin) GetSubscriptionsForAccessibleChannelsOrProjects(subscriptionList []*serializers.SubscriptionDetails, teamID, mattermostUserID string) ([]*serializers.SubscriptionDetails, error)
func (*Plugin) HandleStaticFiles ¶
func (p *Plugin) HandleStaticFiles()
Handles the static files under the assets directory.
func (*Plugin) InitRoutes ¶
func (p *Plugin) InitRoutes()
Add custom routes and corresponding handlers here
func (*Plugin) IsAccessTokenExpired ¶ added in v1.0.0
IsAccessTokenExpired checks if a user's access token is expired
func (*Plugin) IsAnyProjectLinked ¶
func (*Plugin) IsProjectLinked ¶
func (p *Plugin) IsProjectLinked(projectList []serializers.ProjectDetails, project serializers.ProjectDetails) (*serializers.ProjectDetails, bool)
func (*Plugin) IsSubscriptionPresent ¶ added in v0.2.0
func (p *Plugin) IsSubscriptionPresent(subscriptionList []*serializers.SubscriptionDetails, subscription *serializers.SubscriptionDetails) (*serializers.SubscriptionDetails, bool)
func (*Plugin) MessageWillBePosted ¶
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 ¶
Invoked when the plugin is activated
func (*Plugin) OnConfigurationChange ¶
Invoked when configuration changes may have been made.
func (*Plugin) ParseSubscriptionsToCommandResponse ¶ added in v1.0.0
func (p *Plugin) ParseSubscriptionsToCommandResponse(subscriptionsList []*serializers.SubscriptionDetails, channelID, createdBy, userID, command string) string
func (*Plugin) PostTaskPreview ¶ added in v1.0.0
postTaskPreview function returns the new post containing the preview of the work item. (UI may change in the future)
func (*Plugin) RefreshOAuthToken ¶
RefreshOAuthToken refreshes OAuth token
func (*Plugin) UserAlreadyConnected ¶
UserAlreadyConnected checks if a user is already connected