Documentation
¶
Index ¶
- Constants
- func CanDeploy(p Service, deployType apps.DeployType) error
- func SortTopBindings(in []apps.Binding) (out []apps.Binding)
- type API
- type Admin
- type Internal
- type Notifier
- type Proxy
- func (p *Proxy) AddBuiltinUpstream(appID apps.AppID, up upstream.Upstream)
- func (p *Proxy) CanDeploy(deployType apps.DeployType) (allowed, usable bool)
- func (p *Proxy) Configure(conf config.Config, log utils.Logger) error
- func (p *Proxy) DisableApp(r *incoming.Request, cc apps.Context, appID apps.AppID) (string, error)
- func (p *Proxy) EnableApp(r *incoming.Request, cc apps.Context, appID apps.AppID) (string, error)
- func (p *Proxy) GetApp(r *incoming.Request) (*apps.App, error)
- func (p *Proxy) GetBindings(r *incoming.Request, cc apps.Context) ([]apps.Binding, error)
- func (p *Proxy) GetInstalledApp(appID apps.AppID, checkEnabled bool) (*apps.App, error)
- func (p *Proxy) GetInstalledApps() []apps.App
- func (p *Proxy) GetListedApps(filter string, includePluginApps bool) []apps.ListedApp
- func (p *Proxy) GetManifest(appID apps.AppID) (*apps.Manifest, error)
- func (p *Proxy) InstallApp(r *incoming.Request, cc apps.Context, appID apps.AppID, ...) (*apps.App, string, error)
- func (p *Proxy) InvokeCall(r *incoming.Request, creq apps.CallRequest) (*apps.App, apps.CallResponse)
- func (p *Proxy) InvokeCompleteRemoteOAuth2(r *incoming.Request, urlValues map[string]interface{}) error
- func (p *Proxy) InvokeGetBindings(r *incoming.Request, cc apps.Context) ([]apps.Binding, error)
- func (p *Proxy) InvokeGetRemoteOAuth2ConnectURL(r *incoming.Request) (string, error)
- func (p *Proxy) InvokeGetStatic(r *incoming.Request, path string) (io.ReadCloser, int, error)
- func (p *Proxy) InvokeRemoteWebhook(r *incoming.Request, httpCallRequest apps.HTTPCallRequest) error
- func (p *Proxy) NewIncomingRequest() *incoming.Request
- func (p *Proxy) NotifyChannelCreated(teamID, channelID string)
- func (p *Proxy) NotifyUserCreated(userID string)
- func (p *Proxy) NotifyUserJoinedChannel(channelID, userID string)
- func (p *Proxy) NotifyUserJoinedTeam(teamID, userID string)
- func (p *Proxy) NotifyUserLeftChannel(channelID, userID string)
- func (p *Proxy) NotifyUserLeftTeam(teamID, userID string)
- func (p *Proxy) PingInstalledApps(ctx context.Context) (installed []apps.App, reachable map[apps.AppID]bool)
- func (p *Proxy) SynchronizeInstalledApps() error
- func (p *Proxy) UninstallApp(r *incoming.Request, cc apps.Context, appID apps.AppID, force bool) (text string, err error)
- func (p *Proxy) UpdateAppListing(r *incoming.Request, req appclient.UpdateAppListingRequest) (*apps.Manifest, error)
- func (p *Proxy) ValidateWebhookAuthentication(r *incoming.Request, httpCallRequest apps.HTTPCallRequest) error
- type Service
Constants ¶
const PrevVersion = "prev_version"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶ added in v1.2.0
type API interface {
// REST API methods used by user agents (mobile, desktop, web).
GetApp(*incoming.Request) (*apps.App, error)
GetBindings(*incoming.Request, apps.Context) ([]apps.Binding, error)
InvokeCall(*incoming.Request, apps.CallRequest) (*apps.App, apps.CallResponse)
InvokeCompleteRemoteOAuth2(_ *incoming.Request, urlValues map[string]interface{}) error
InvokeGetBindings(*incoming.Request, apps.Context) ([]apps.Binding, error)
InvokeGetRemoteOAuth2ConnectURL(*incoming.Request) (string, error)
InvokeGetStatic(_ *incoming.Request, path string) (io.ReadCloser, int, error)
InvokeRemoteWebhook(*incoming.Request, apps.HTTPCallRequest) error
ValidateWebhookAuthentication(*incoming.Request, apps.HTTPCallRequest) error
}
API implements user-level operations, usually invoked from httpin handlers. These methods expect the acting user, to and from apps to be set in the request.
type Admin ¶ added in v1.0.0
type Admin interface {
DisableApp(*incoming.Request, apps.Context, apps.AppID) (string, error)
EnableApp(*incoming.Request, apps.Context, apps.AppID) (string, error)
InstallApp(_ *incoming.Request, _ apps.Context, _ apps.AppID, _ apps.DeployType, trustedApp bool, secret string) (*apps.App, string, error)
UpdateAppListing(*incoming.Request, appclient.UpdateAppListingRequest) (*apps.Manifest, error)
UninstallApp(*incoming.Request, apps.Context, apps.AppID, bool) (string, error)
}
Admin defines the REST API methods to manipulate Apps. Since they operate in "admin" space, they accept a separate appID parameter rather than expecting a ToApp too be set in the request.
type Internal ¶ added in v1.0.0
type Internal interface {
AddBuiltinUpstream(apps.AppID, upstream.Upstream)
CanDeploy(apps.DeployType) (allowed, usable bool)
NewIncomingRequest() *incoming.Request
SynchronizeInstalledApps() error
GetInstalledApp(_ apps.AppID, checkEnabled bool) (*apps.App, error)
GetInstalledApps() []apps.App
PingInstalledApps(context.Context) (installed []apps.App, reachable map[apps.AppID]bool)
GetListedApps(filter string, includePluginApps bool) []apps.ListedApp
GetManifest(apps.AppID) (*apps.Manifest, error)
}
Internal implements go API used by other plugin-apps packages. When relevant, they rely on the ActingUser set in the request, but usually have the app id parameters passed in explicitly, using request for logging.
type Notifier ¶ added in v1.0.0
type Notifier interface {
NotifyUserCreated(userID string)
NotifyUserJoinedChannel(channelID, userID string)
NotifyUserLeftChannel(channelID, userID string)
NotifyUserJoinedTeam(teamID, userID string)
NotifyUserLeftTeam(teamID, userID string)
NotifyChannelCreated(teamID, channelID string)
}
Notifier implements subscription notifications, each one may be going out to multiple apps. Notify functions create their own app requests.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Proxy) AddBuiltinUpstream ¶
func (*Proxy) CanDeploy ¶ added in v1.0.0
func (p *Proxy) CanDeploy(deployType apps.DeployType) (allowed, usable bool)
CanDeploy returns the availability of deployType. allowed indicates that the type can be used in the current configuration. usable indicates that it is configured and can be accessed, or deployed to.
func (*Proxy) DisableApp ¶
func (*Proxy) GetBindings ¶
GetBindings fetches bindings for all apps. We should avoid unnecessary logging here as this route is called very often.
func (*Proxy) GetInstalledApp ¶
func (*Proxy) GetInstalledApps ¶
func (*Proxy) GetListedApps ¶
func (*Proxy) InstallApp ¶
func (p *Proxy) InstallApp(r *incoming.Request, cc apps.Context, appID apps.AppID, deployType apps.DeployType, trusted bool, secret string) (*apps.App, string, error)
InstallApp installs an App.
- cc is the Context that will be passed down to the App's OnInstall callback.
func (*Proxy) InvokeCall ¶ added in v1.2.0
func (p *Proxy) InvokeCall(r *incoming.Request, creq apps.CallRequest) (*apps.App, apps.CallResponse)
func (*Proxy) InvokeCompleteRemoteOAuth2 ¶ added in v1.2.0
func (*Proxy) InvokeGetBindings ¶ added in v1.2.0
InvokeGetBindings fetches bindings for a specific apps. We should avoid unnecessary logging here as this route is called very often.
func (*Proxy) InvokeGetRemoteOAuth2ConnectURL ¶ added in v1.2.0
InvokeGetRemoteOAuth2ConnectURL returns the URL for the user to open, that would start the OAuth2 authentication flow. r.ActingUser and r.ToApp must be already set.
func (*Proxy) InvokeGetStatic ¶ added in v1.2.0
func (*Proxy) InvokeRemoteWebhook ¶ added in v1.2.0
func (*Proxy) NewIncomingRequest ¶ added in v1.2.0
func (*Proxy) NotifyChannelCreated ¶ added in v1.2.0
NotifyChannelCreated handles plugin's ChannelHasBeenCreated callback. It emits "channel_created" notifications to subscribed apps.
func (*Proxy) NotifyUserCreated ¶ added in v1.2.0
NotifyUserCreated handles plugin's UserHasBeenCreated callback. It emits "user_created" notifications to subscribed apps.
func (*Proxy) NotifyUserJoinedChannel ¶ added in v1.2.0
NotifyUserJoinedChannel handles plugin's UserHasJoinedChannel callback. It emits "user_joined_channel" and "bot_joined_channel" notifications to subscribed apps.
func (*Proxy) NotifyUserJoinedTeam ¶ added in v1.2.0
NotifyUserJoinedTeam handles plugin's UserHasJoinedTeam callback. It emits "user_joined_team" and "bot_joined_team" notifications to subscribed apps.
func (*Proxy) NotifyUserLeftChannel ¶ added in v1.2.0
NotifyUserLeftChannel handles plugin's UserHasLeftChannel callback. It emits "user_left_channel" and "bot_left_channel" notifications to subscribed apps.
func (*Proxy) NotifyUserLeftTeam ¶ added in v1.2.0
NotifyUserLeftTeam handles plugin's UserHasLeftTeam callback. It emits "user_left_team" and "bot_left_team" notifications to subscribed apps.
func (*Proxy) PingInstalledApps ¶ added in v1.2.0
func (*Proxy) SynchronizeInstalledApps ¶
SynchronizeInstalledApps synchronizes installed apps with known manifests, performing OnVersionChanged call on the App as needed.