Documentation ¶
Index ¶
- Constants
- func CanDeploy(p Service, deployType apps.DeployType) error
- type Admin
- type AppMetadataForClient
- type CallResponse
- type Internal
- type Invoker
- type Notifier
- type Proxy
- func (p *Proxy) AddBuiltinUpstream(appID apps.AppID, up upstream.Upstream)
- func (p *Proxy) Call(r *incoming.Request, creq apps.CallRequest) CallResponse
- func (p *Proxy) CanDeploy(deployType apps.DeployType) (allowed, usable bool)
- func (p *Proxy) CompleteRemoteOAuth2(r *incoming.Request, appID apps.AppID, urlValues map[string]interface{}) error
- 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) GetAppBindings(r *incoming.Request, cc apps.Context, app apps.App) ([]apps.Binding, error)
- func (p *Proxy) GetBindings(r *incoming.Request, cc apps.Context) ([]apps.Binding, error)
- func (p *Proxy) GetInstalledApp(_ *incoming.Request, appID apps.AppID) (*apps.App, error)
- func (p *Proxy) GetInstalledApps(r *incoming.Request, ping bool) (installed []apps.App, reachable map[apps.AppID]bool)
- func (p *Proxy) GetListedApps(_ *incoming.Request, filter string, includePluginApps bool) []apps.ListedApp
- func (p *Proxy) GetManifest(_ *incoming.Request, appID apps.AppID) (*apps.Manifest, error)
- func (p *Proxy) GetRemoteOAuth2ConnectURL(r *incoming.Request, appID apps.AppID) (string, error)
- func (p *Proxy) GetStatic(r *incoming.Request, appID apps.AppID, path string) (io.ReadCloser, int, error)
- func (p *Proxy) InstallApp(r *incoming.Request, cc apps.Context, appID apps.AppID, ...) (*apps.App, string, error)
- func (p *Proxy) Notify(base apps.Context, subj apps.Subject) error
- func (p *Proxy) NotifyRemoteWebhook(r *incoming.Request, appID apps.AppID, httpCallRequest apps.HTTPCallRequest) error
- func (p *Proxy) NotifyUserHasJoinedChannel(cc apps.Context) error
- func (p *Proxy) NotifyUserHasJoinedTeam(cc apps.Context) error
- func (p *Proxy) NotifyUserHasLeftChannel(cc apps.Context) error
- func (p *Proxy) NotifyUserHasLeftTeam(cc apps.Context) error
- func (p *Proxy) SynchronizeInstalledApps() error
- func (p *Proxy) UninstallApp(r *incoming.Request, cc apps.Context, appID apps.AppID) (string, error)
- func (p *Proxy) UpdateAppListing(r *incoming.Request, req appclient.UpdateAppListingRequest) (*apps.Manifest, error)
- type Service
Constants ¶
const PrevVersion = "prev_version"
Variables ¶
This section is empty.
Functions ¶
Types ¶
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) (string, error) }
Admin defines the REST API methods to manipulate Apps.
type AppMetadataForClient ¶ added in v1.0.0
type CallResponse ¶ added in v1.0.0
type CallResponse struct { apps.CallResponse // Used to provide info about the App to client, e.g. the bot user id AppMetadata AppMetadataForClient `json:"app_metadata"` }
CallResponse contains everything the CallResponse struct contains, plus some additional data for the client, such as information about the App's bot account.
Apps will use the CallResponse struct to respond to a CallRequest, and the proxy will decorate the response using the CallResponse to provide additional information.
func NewProxyCallResponse ¶ added in v1.0.0
func NewProxyCallResponse(response apps.CallResponse) CallResponse
func (CallResponse) WithMetadata ¶ added in v1.0.0
func (r CallResponse) WithMetadata(metadata AppMetadataForClient) CallResponse
type Internal ¶ added in v1.0.0
type Internal interface { AddBuiltinUpstream(apps.AppID, upstream.Upstream) CanDeploy(apps.DeployType) (allowed, usable bool) GetAppBindings(*incoming.Request, apps.Context, apps.App) ([]apps.Binding, error) GetInstalledApp(*incoming.Request, apps.AppID) (*apps.App, error) GetInstalledApps(_ *incoming.Request, ping bool) (installed []apps.App, reachable map[apps.AppID]bool) GetListedApps(_ *incoming.Request, filter string, includePluginApps bool) []apps.ListedApp GetManifest(*incoming.Request, apps.AppID) (*apps.Manifest, error) SynchronizeInstalledApps() error }
Internal implements go API used by other packages.
type Invoker ¶ added in v1.0.0
type Invoker interface { // REST API methods used by user agents (mobile, desktop, web). Call(*incoming.Request, apps.CallRequest) CallResponse CompleteRemoteOAuth2(_ *incoming.Request, _ apps.AppID, urlValues map[string]interface{}) error GetBindings(*incoming.Request, apps.Context) ([]apps.Binding, error) GetRemoteOAuth2ConnectURL(*incoming.Request, apps.AppID) (string, error) GetStatic(_ *incoming.Request, _ apps.AppID, path string) (io.ReadCloser, int, error) }
Invoker implements operations that invoke the Apps.
type Notifier ¶ added in v1.0.0
type Notifier interface { Notify(apps.Context, apps.Subject) error NotifyRemoteWebhook(*incoming.Request, apps.AppID, apps.HTTPCallRequest) error // NotifyMessageHasBeenPosted(*model.Post, apps.Context) error NotifyUserHasJoinedChannel(apps.Context) error NotifyUserHasLeftChannel(apps.Context) error NotifyUserHasJoinedTeam(apps.Context) error NotifyUserHasLeftTeam(apps.Context) error }
Notifier implements user-less notification sinks.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Proxy) AddBuiltinUpstream ¶
func (*Proxy) Call ¶
func (p *Proxy) Call(r *incoming.Request, creq apps.CallRequest) CallResponse
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) CompleteRemoteOAuth2 ¶ added in v0.3.0
func (*Proxy) DisableApp ¶
func (*Proxy) GetAppBindings ¶ added in v1.0.0
func (p *Proxy) GetAppBindings(r *incoming.Request, cc apps.Context, app apps.App) ([]apps.Binding, error)
GetAppBindings fetches bindings for a specific apps. We should avoid unnecessary logging here as this route is called very often.
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) GetManifest ¶
func (*Proxy) GetRemoteOAuth2ConnectURL ¶ added in v0.3.0
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) NotifyRemoteWebhook ¶ added in v0.3.0
func (*Proxy) NotifyUserHasJoinedChannel ¶ added in v1.0.0
func (*Proxy) NotifyUserHasJoinedTeam ¶ added in v1.0.0
func (*Proxy) NotifyUserHasLeftChannel ¶ added in v1.0.0
func (*Proxy) NotifyUserHasLeftTeam ¶ added in v1.0.0
func (*Proxy) SynchronizeInstalledApps ¶
SynchronizeInstalledApps synchronizes installed apps with known manifests, performing OnVersionChanged call on the App as needed.