Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- func (conf Config) AppURL(appID apps.AppID) string
- func (conf Config) GetPluginVersionInfo() map[string]interface{}
- func (conf *Config) InfoTemplateData() map[string]string
- func (conf Config) StaticURL(appID apps.AppID, name string) string
- func (conf *Config) Update(stored StoredConfig, mmconf *model.Config, license *model.License, ...) error
- type Configurable
- type Service
- type StoredConfig
- type TestService
- func (s *TestService) Get() Config
- func (s *TestService) I18N() *i18n.Bundle
- func (s *TestService) Logger() utils.Logger
- func (s *TestService) MattermostAPI() *pluginapi.Client
- func (s *TestService) MattermostConfig() configservice.ConfigService
- func (s *TestService) Reconfigure(StoredConfig, ...Configurable) error
- func (s *TestService) StoreConfig(sc StoredConfig) error
- func (s *TestService) Telemetry() *telemetry.Telemetry
- func (s TestService) WithMattermostAPI(mm *pluginapi.Client) *TestService
- func (s TestService) WithMattermostConfig(mmconfig model.Config) *TestService
Constants ¶
View Source
const ( MattermostSessionIDHeader = "Mattermost-Session-Id" MattermostPluginIDHeader = "Mattermost-Plugin-Id" MattermostUserIDHeader = "Mattermost-User-Id" )
View Source
const ( Repository = "mattermost-plugin-apps" CommandTrigger = "apps" ManifestsFile = "manifests.json" BotUsername = "appsbot" BotDisplayName = "Mattermost Apps" BotDescription = "Mattermost Apps Registry and API proxy." )
Internal configuration apps.of mattermost-plugin-apps
View Source
const ( // Top-level path(s) for HTTP example apps. HelloHTTPPath = "/example/hello" WebSocketEventRefreshBindings = "refresh_bindings" WebSocketEventPluginEnabled = "plugin_enabled" WebSocketEventPluginDisabled = "plugin_disabled" )
View Source
const ( PropTeamID = "team_id" PropChannelID = "channel_id" PropPostID = "post_id" PropUserAgent = "user_agent_type" )
View Source
const ( // KVAppPrefix is the Apps global namespace. KVAppPrefix = ".k" // KVUserPrefix is the global namespase used to store user // records. KVUserPrefix = ".u" // KVUserPrefix is the key to store OAuth2 user // records. KVUserKey = "oauth2_user" // KVOAuth2StatePrefix is the global namespase used to store OAuth2 // ephemeral state data. KVOAuth2StatePrefix = ".o" // KVSubPrefix is used for keys storing subscriptions. KVSubPrefix = "sub." // KVInstalledAppPrefix is used to store App records. KVInstalledAppPrefix = "app." // KVLocalManifestPrefix is used to store locally-listed manifests. KVLocalManifestPrefix = "man." KVTokenPrefix = ".t" // KVCallOnceKey and KVClusterMutexKey are used for invoking App Calls once, // usually upon a Mattermost instance startup. KVCallOnceKey = "CallOnce" KVClusterMutexKey = "Cluster_Mutex" )
KV namespace
Keys starting with a '.' are reserved for app-specific keys in the "hashkey" format. Hashkeys have the following format (see service_test.go#TestHashkey for examples):
- global prefix of ".X" where X is exactly 1 byte (2 bytes)
- bot user ID (26 bytes)
- app-specific prefix, limited to 2 non-space ASCII characters, right-filled with ' ' to 2 bytes.
- app-specific key hash: 16 bytes, ascii85 (20 bytes)
All other keys must start with an ASCII letter. '.' is usually used as the terminator since it is not used in the base64 representation.
View Source
const (
RequestTimeout = time.Second * 30
)
Variables ¶
View Source
var BuildDate string
View Source
var BuildHash string
View Source
var BuildHashShort string
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
StoredConfig
PluginManifest model.Manifest
BuildDate string
BuildHash string
BuildHashShort string
DeveloperMode bool
AllowHTTPApps bool
MattermostCloudMode bool
BotUserID string
MattermostSiteURL string
MattermostLocalURL string
PluginURL string
PluginURLPath string
// Maximum size of incoming remote webhook messages
MaxWebhookSize int64
AWSRegion string
AWSAccessKey string
AWSSecretKey string
AWSS3Bucket string
}
Config represents the the metadata handed to all request runners (command, http).
Config should be abbreviated as `conf`.
func (Config) GetPluginVersionInfo ¶ added in v1.0.0
func (*Config) InfoTemplateData ¶ added in v1.0.0
type Service ¶
type Service interface {
Get() Config
MattermostAPI() *pluginapi.Client
MattermostConfig() configservice.ConfigService
I18N() *i18n.Bundle
Telemetry() *telemetry.Telemetry
Reconfigure(StoredConfig, ...Configurable) error
StoreConfig(sc StoredConfig) error
}
type StoredConfig ¶
type StoredConfig struct {
// InstalledApps is a list of all apps installed on the Mattermost instance.
//
// For each installed app, an entry of string(AppID) -> sha1(App) is added,
// and the App struct is stored in KV under app_<sha1(App)>. Implementation
// in `store.App`.
InstalledApps map[string]string `json:"installed_apps,omitempty"`
// LocalManifests is a list of locally-stored manifests. Local is in
// contrast to the "global" list of manifests which in the initial version
// is loaded from S3.
//
// For each installed app, an entry of string(AppID) -> sha1(Manifest) is
// added, and the Manifest struct is stored in KV under
// manifest_<sha1(Manifest)>. Implementation in `store.Manifest`.
LocalManifests map[string]string `json:"local_manifests,omitempty"`
}
StoredConfig represents the data stored in and managed with the Mattermost config.
StoredConfig should be abbreviated as sc.
type TestService ¶ added in v1.0.0
type TestService struct {
// contains filtered or unexported fields
}
func NewTestConfigService ¶ added in v1.0.0
func NewTestConfigService(testConfig *Config) *TestService
func NewTestService ¶ added in v1.0.0
func NewTestService(testConfig *Config) (*TestService, *plugintest.API)
func (*TestService) Get ¶ added in v1.0.0
func (s *TestService) Get() Config
func (*TestService) I18N ¶ added in v1.0.0
func (s *TestService) I18N() *i18n.Bundle
func (*TestService) Logger ¶ added in v1.0.0
func (s *TestService) Logger() utils.Logger
func (*TestService) MattermostAPI ¶ added in v1.0.0
func (s *TestService) MattermostAPI() *pluginapi.Client
func (*TestService) MattermostConfig ¶ added in v1.0.0
func (s *TestService) MattermostConfig() configservice.ConfigService
func (*TestService) Reconfigure ¶ added in v1.0.0
func (s *TestService) Reconfigure(StoredConfig, ...Configurable) error
func (*TestService) StoreConfig ¶ added in v1.0.0
func (s *TestService) StoreConfig(sc StoredConfig) error
func (*TestService) Telemetry ¶ added in v1.0.0
func (s *TestService) Telemetry() *telemetry.Telemetry
func (TestService) WithMattermostAPI ¶ added in v1.0.0
func (s TestService) WithMattermostAPI(mm *pluginapi.Client) *TestService
func (TestService) WithMattermostConfig ¶ added in v1.0.0
func (s TestService) WithMattermostConfig(mmconfig model.Config) *TestService
Click to show internal directories.
Click to hide internal directories.