api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Repository     = "mattermost-plugin-apps"
	CommandTrigger = "apps"

	BotUsername    = "appsbot"
	BotDisplayName = "Mattermost Apps"
	BotDescription = "Mattermost Apps Registry and API proxy."

	// TODO replace Interactive Dialogs with Modal, eliminate the need for
	// /dialog endpoints.
	InteractiveDialogPath = "/dialog"

	// Top-level path(s) for HTTP example apps.
	HelloHTTPPath = "/example/hello"

	// Top-level path for the REST APIs exposed by the plugin itself.
	APIPath = "/api/v1"

	// Top-level path for the Apps namespaces, followed by /AppID/subpath.
	AppsPath = "/apps"

	// OAuth2 sub-paths.
	PathOAuth2         = "/oauth2"          // convention for Mattermost Apps, comes from OAuther
	PathOAuth2Complete = "/oauth2/complete" // convention for Mattermost Apps, comes from OAuther

	// Marketplace sub-paths.
	PathMarketplace = "/marketplace"

	// Other sub-paths.
	CallPath        = "/call"
	KVPath          = "/kv"
	SubscribePath   = "/subscribe"
	UnsubscribePath = "/unsubscribe"
	StaticAssetPath = "/static"
	BindingsPath    = "/bindings"

	WebSocketEventRefreshBindings = "refresh_bindings"
)

Internal configuration apps.of mattermost-plugin-apps

View Source
const (
	PropTeamID    = "team_id"
	PropChannelID = "channel_id"
	PropPostID    = "post_id"
)
View Source
const OutgoingAuthHeader = "Mattermost-App-Authorization"

Variables

View Source
var ErrNotABot = errors.New("not a bot")

Functions

This section is empty.

Types

type AWS

type AWS interface {
	InvokeLambda(appID apps.AppID, appVersion apps.AppVersion, functionName, invocationType string, payload []byte) ([]byte, error)
}

type Admin

type Admin interface {
	ListApps() ([]*apps.App, md.MD, error)
	GetApp(appID apps.AppID) (*apps.App, error)
	InstallApp(*apps.Context, apps.SessionToken, *apps.InInstallApp) (*apps.App, md.MD, error)
	UninstallApp(appID apps.AppID) error
	ProvisionApp(*apps.Context, apps.SessionToken, *apps.InProvisionApp) (*apps.App, md.MD, error)
	LoadAppsList() error
}

type AppServices

type AppServices interface {
	Subscribe(*apps.Subscription) error
	Unsubscribe(*apps.Subscription) error
	KVSet(botUserID, prefix, id string, ref interface{}) (bool, error)
	KVGet(botUserID, prefix, id string, ref interface{}) error
	KVDelete(botUserID, prefix, id string) error
}

type AppStore

type AppStore interface {
	Get(appID apps.AppID) (*apps.App, error)
	GetAll() []*apps.App
	Save(app *apps.App) error
	Delete(app *apps.App) error
}

type BuildConfig

type BuildConfig struct {
	*model.Manifest
	BuildDate      string
	BuildHash      string
	BuildHashShort string
}

type Config

type Config struct {
	*StoredConfig
	*BuildConfig

	BotUserID              string
	MattermostSiteHostname string
	MattermostSiteURL      string
	PluginURL              string
	PluginURLPath          string
}

Config represents the the metadata handed to all request runners (command, http).

type ConfigMapper

type ConfigMapper interface {
	ConfigMap() (result map[string]interface{})
}

type Configurator

type Configurator interface {
	GetConfig() Config
	GetMattermostConfig() *model.Config
	RefreshConfig(*StoredConfig) error
	StoreConfig(ConfigMapper) error
}

type JWTClaims

type JWTClaims struct {
	jwt.StandardClaims
	ActingUserID string `json:"acting_user_id,omitempty"`
}

type ManifestStore

type ManifestStore interface {
	Get(appID apps.AppID) (*apps.Manifest, error)
	GetAll() map[apps.AppID]*apps.Manifest
	Save(manifest *apps.Manifest)
	Delete(appID apps.AppID)
	Cleanup()
}

type Proxy

type Proxy interface {
	GetBindings(*apps.Context) ([]*apps.Binding, error)
	Call(apps.SessionToken, *apps.Call) *apps.CallResponse
	Notify(cc *apps.Context, subj apps.Subject) error

	ProvisionBuiltIn(apps.AppID, Upstream)

	GetAsset(apps.AppID, string) (io.ReadCloser, int, error)
}

type Service

type Service struct {
	Configurator Configurator
	Mattermost   *pluginapi.Client
	Proxy        Proxy
	Admin        Admin
	AppServices  AppServices
	AWS          AWS
}

type Store

type Store interface {
	App() AppStore
	Sub() SubStore
	Manifest() ManifestStore
}

type StoredConfig

type StoredConfig struct {
	Apps               map[string]interface{}
	AWSAccessKeyID     string
	AWSSecretAccessKey string
}

StoredConfig represents the data stored in and managed with the Mattermost config.

func (*StoredConfig) ConfigMap

func (sc *StoredConfig) ConfigMap() map[string]interface{}

type SubStore

type SubStore interface {
	Get(subject apps.Subject, teamID, channelID string) ([]*apps.Subscription, error)
	Save(sub *apps.Subscription) error
	Delete(*apps.Subscription) error
}

type Upstream

type Upstream interface {
	Roundtrip(call *apps.Call) (io.ReadCloser, error)
	OneWay(call *apps.Call) error
}

Directories

Path Synopsis
impl
aws
Package mock_api is a generated GoMock package.
Package mock_api is a generated GoMock package.

Jump to

Keyboard shortcuts

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