Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertSubscriptionToMap(subscription *serializer.SubscriptionResponse) (map[string]interface{}, error)
- func GetPageAndPerPage(r *http.Request) (page, perPage int)
- func ParseSubscriptionsToCommandResponse(subscriptions []*serializer.SubscriptionResponse) string
- func ProcessComments(comments string, page, perPage int) []string
- type AuthToken
- type Client
- type CommandHandleFunc
- type Error
- type ErrorResponse
- type OAuth2StateStore
- type Plugin
- func (p *Plugin) CompleteOAuth2(authedUserID, code, state string) error
- func (p *Plugin) DM(mattermostUserID, format string, args ...interface{}) (string, error)
- func (p *Plugin) DisconnectUser(mattermostUserID string) error
- func (p *Plugin) Ephemeral(userID, channelID, rootID, format string, args ...interface{})
- func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
- func (p *Plugin) GetClientFromRequest(r *http.Request) Client
- func (p *Plugin) GetClientFromUser(args *model.CommandArgs, user *serializer.User) Client
- func (p *Plugin) GetPluginURL() string
- func (p *Plugin) GetPluginURLPath() string
- func (p *Plugin) GetRecordFromServiceNowForSubscription(subscription *serializer.SubscriptionResponse, client Client, ...)
- func (p *Plugin) GetSiteURL() string
- func (p *Plugin) GetUser(mattermostUserID string) (*serializer.User, error)
- func (p *Plugin) InitAPI() *mux.Router
- func (p *Plugin) InitOAuth2(mattermostUserID string) (string, error)
- func (p *Plugin) NewClient(ctx context.Context, token *oauth2.Token) Client
- func (p *Plugin) NewEncodedAuthToken(token *oauth2.Token) (returnToken string, returnErr error)
- func (p *Plugin) NewOAuth2Config() *oauth2.Config
- func (p *Plugin) NewStore(api plugin.API) Store
- func (p *Plugin) OnActivate() error
- func (p *Plugin) OnConfigurationChange() error
- func (p *Plugin) ParseAuthToken(encoded string) (*oauth2.Token, error)
- func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)
- type Store
- type UserStore
Constants ¶
View Source
const ( UserKeyPrefix = "user_" OAuth2KeyPrefix = "oauth2_" )
View Source
const (
OAuth2KeyExpiration = 15 * time.Minute
)
Variables ¶
View Source
var ErrNotFound = kvstore.ErrNotFound
View Source
var ErrorContentTypeNotJSON = fmt.Errorf("content type of the response is not JSON")
Functions ¶
func ConvertSubscriptionToMap ¶
func ConvertSubscriptionToMap(subscription *serializer.SubscriptionResponse) (map[string]interface{}, error)
func GetPageAndPerPage ¶
func ParseSubscriptionsToCommandResponse ¶
func ParseSubscriptionsToCommandResponse(subscriptions []*serializer.SubscriptionResponse) string
func ProcessComments ¶ added in v1.2.0
Types ¶
type Client ¶
type Client interface { ActivateSubscriptions() (int, error) CreateSubscription(*serializer.SubscriptionPayload) (int, error) GetSubscription(subscriptionID string) (*serializer.SubscriptionResponse, int, error) GetAllSubscriptions(channelID, userID, subscriptionType, limit, offset string) ([]*serializer.SubscriptionResponse, int, error) DeleteSubscription(subscriptionID string) (int, error) EditSubscription(subscriptionID string, subscription *serializer.SubscriptionPayload) (int, error) CheckForDuplicateSubscription(*serializer.SubscriptionPayload) (bool, int, error) SearchRecordsInServiceNow(tableName, searchTerm, limit, offset string) ([]*serializer.ServiceNowPartialRecord, int, error) GetRecordFromServiceNow(tableName, sysID string) (*serializer.ServiceNowRecord, int, error) GetAllComments(recordType, recordID string) (string, int, error) AddComment(recordType, recordID string, payload *serializer.ServiceNowCommentPayload) (int, error) }
type CommandHandleFunc ¶
type ErrorResponse ¶
type OAuth2StateStore ¶
type OAuth2StateStore interface { VerifyOAuth2State(state string) error StoreOAuth2State(state string) error }
OAuth2StateStore manages OAuth2 state
type Plugin ¶
type Plugin struct { plugin.MattermostPlugin CommandHandlers map[string]CommandHandleFunc // contains filtered or unexported fields }
Plugin implements the interface expected by the Mattermost server to communicate between the server and plugin processes.
func (*Plugin) CompleteOAuth2 ¶
func (*Plugin) DisconnectUser ¶
func (*Plugin) ExecuteCommand ¶
func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
func (*Plugin) GetClientFromUser ¶
func (p *Plugin) GetClientFromUser(args *model.CommandArgs, user *serializer.User) Client
func (*Plugin) GetPluginURL ¶
func (*Plugin) GetPluginURLPath ¶
func (*Plugin) GetRecordFromServiceNowForSubscription ¶
func (p *Plugin) GetRecordFromServiceNowForSubscription(subscription *serializer.SubscriptionResponse, client Client, wg *sync.WaitGroup)
func (*Plugin) GetSiteURL ¶
func (*Plugin) GetUser ¶
func (p *Plugin) GetUser(mattermostUserID string) (*serializer.User, error)
func (*Plugin) NewEncodedAuthToken ¶
func (*Plugin) NewOAuth2Config ¶
func (*Plugin) OnActivate ¶
func (*Plugin) OnConfigurationChange ¶
OnConfigurationChange is invoked when configuration changes may have been made.
func (*Plugin) ParseAuthToken ¶
type Store ¶
type Store interface { UserStore OAuth2StateStore }
Click to show internal directories.
Click to hide internal directories.