appservices

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CheckSubscriptionPermission added in v1.0.0

func CheckSubscriptionPermission(checker PermissionChecker, sub apps.Subscription, channelID, teamID string) error

Types

type AppServices

type AppServices struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(conf config.Service, store *store.Service) *AppServices

func (*AppServices) GetOAuth2User added in v0.3.0

func (a *AppServices) GetOAuth2User(r *incoming.Request, appID apps.AppID, actingUserID string) ([]byte, error)

GetOAuth2User returns the stored OAuth2 user data for a given user and app. If err != nil, the returned data is always valid JSON.

func (*AppServices) GetSubscriptions added in v1.0.0

func (a *AppServices) GetSubscriptions(r *incoming.Request, appID apps.AppID, userID string) ([]apps.Subscription, error)

func (*AppServices) KVDelete

func (a *AppServices) KVDelete(r *incoming.Request, appID apps.AppID, actingUserID, prefix, id string) error

func (*AppServices) KVGet

func (a *AppServices) KVGet(r *incoming.Request, appID apps.AppID, actingUserID, prefix, id string) ([]byte, error)

KVGet returns the stored KV data for a given user and app. If err != nil, the returned data is always valid JSON.

func (*AppServices) KVList added in v1.0.0

func (a *AppServices) KVList(r *incoming.Request, appID apps.AppID, actingUserID, prefix string, processf func(key string) error) error

func (*AppServices) KVSet

func (a *AppServices) KVSet(r *incoming.Request, appID apps.AppID, actingUserID, prefix, id string, data []byte) (bool, error)

func (*AppServices) StoreOAuth2App added in v0.3.0

func (a *AppServices) StoreOAuth2App(r *incoming.Request, appID apps.AppID, actingUserID string, data []byte) error

func (*AppServices) StoreOAuth2User added in v0.3.0

func (a *AppServices) StoreOAuth2User(r *incoming.Request, appID apps.AppID, actingUserID string, data []byte) error

func (*AppServices) Subscribe

func (a *AppServices) Subscribe(r *incoming.Request, sub apps.Subscription) error

func (*AppServices) Unsubscribe

func (a *AppServices) Unsubscribe(r *incoming.Request, sub apps.Subscription) error

type PermissionChecker added in v1.0.0

type PermissionChecker interface {
	HasPermissionTo(userID string, permission *model.Permission) bool
	HasPermissionToChannel(userID, channelID string, permission *model.Permission) bool
	HasPermissionToTeam(userID, teamID string, permission *model.Permission) bool
}

type Service

type Service interface {
	Subscribe(r *incoming.Request, sub apps.Subscription) error
	GetSubscriptions(r *incoming.Request, appID apps.AppID, actingUserID string) ([]apps.Subscription, error)
	Unsubscribe(r *incoming.Request, sub apps.Subscription) error

	KVSet(r *incoming.Request, appID apps.AppID, actingUserID, prefix, id string, data []byte) (bool, error)
	KVGet(r *incoming.Request, appID apps.AppID, actingUserID, prefix, id string) ([]byte, error)
	KVDelete(r *incoming.Request, appID apps.AppID, actingUserID, prefix, id string) error
	KVList(r *incoming.Request, appID apps.AppID, actingUserID, namespace string, processf func(key string) error) error

	StoreOAuth2App(r *incoming.Request, appID apps.AppID, actingUserID string, data []byte) error
	StoreOAuth2User(r *incoming.Request, AppID apps.AppID, actingUserID string, data []byte) error
	GetOAuth2User(r *incoming.Request, appID apps.AppID, actingUserID string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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