store

package
v0.0.0-...-5de3a08 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpdateStatusPropertyName              = "update_status"
	GetConfirmationPropertyName           = "get_confirmation"
	ReceiveNotificationsDuringMeetingName = "receive_notifications_during_meetings"
	SubscribePropertyName                 = "subscribe"
	ReceiveUpcomingEventReminderName      = "receive_reminder"
)
View Source
const (
	UpdateStatusSettingID               = "update_status"
	GetConfirmationSettingID            = "get_confirmation"
	ReceiveNotificationsDuringMeetingID = "receive_notification"
	ReceiveRemindersSettingID           = "get_reminders"
	DailySummarySettingID               = "summary_setting"
)
View Source
const (
	UserKeyPrefix             = "user_"
	UserIndexKeyPrefix        = "userindex_"
	MattermostUserIDKeyPrefix = "mmuid_"
	OAuth2KeyPrefix           = "oauth2_"
	SubscriptionKeyPrefix     = "sub_"
	EventKeyPrefix            = "ev_"
	WelcomeKeyPrefix          = "welcome_"
	SettingsPanelPrefix       = "settings_panel_"
)
View Source
const OAuth2KeyExpiration = 15 * time.Minute

Variables

View Source
var DefaultSettings = Settings{
	GetConfirmation:                   false,
	ReceiveNotificationsDuringMeeting: true,
}
View Source
var ErrNotFound = kvstore.ErrNotFound

Functions

This section is empty.

Types

type ChannelEventLink map[string]string

type DailySummaryUserSettings

type DailySummaryUserSettings struct {
	PostTime     string `json:"post_time"` // Kitchen format, i.e. 8:30AM
	Timezone     string `json:"tz"`        // Timezone in MSCal when PostTime is set/updated
	LastPostTime string `json:"last_post_time"`
	Enable       bool   `json:"enable"`
}

func DefaultDailySummaryUserSettings

func DefaultDailySummaryUserSettings() *DailySummaryUserSettings

type Event

type Event struct {
	Remote        *remote.Event
	PluginVersion string
}

type EventMetadata

type EventMetadata struct {
	LinkedChannelIDs map[string]struct{}
}

type EventStore

type EventStore interface {
	LoadEventMetadata(eventID string) (*EventMetadata, error)
	StoreEventMetadata(eventID string, eventMeta *EventMetadata) error
	DeleteEventMetadata(eventID string) error

	AddLinkedChannelToEvent(eventID, channelID string) error
	DeleteLinkedChannelFromEvent(eventID, channelID string) error

	LoadUserEvent(mattermostUserID, eventID string) (*Event, error)
	StoreUserEvent(mattermostUserID string, event *Event) error
	DeleteUserEvent(mattermostUserID, eventID string) error
}

type OAuth2StateStore

type OAuth2StateStore interface {
	VerifyOAuth2State(state string) error
	StoreOAuth2State(state string) error
}

OAuth2StateStore manages OAuth2 state

type Settings

type Settings struct {
	DailySummary                      *DailySummaryUserSettings
	EventSubscriptionID               string
	UpdateStatus                      bool
	GetConfirmation                   bool
	ReceiveReminders                  bool
	ReceiveNotificationsDuringMeeting bool
}

func (Settings) String

func (settings Settings) String() string

type Store

func NewPluginStore

func NewPluginStore(api plugin.API, logger bot.Logger, tracker tracker.Tracker, enableEncryption bool, encryptionKey []byte) Store

type Subscription

type Subscription struct {
	PluginVersion       string
	Remote              *remote.Subscription
	MattermostCreatorID string
}

type SubscriptionStore

type SubscriptionStore interface {
	LoadSubscription(subscriptionID string) (*Subscription, error)
	StoreUserSubscription(user *User, subscription *Subscription) error
	DeleteUserSubscription(user *User, subscriptionID string) error
}

type User

type User struct {
	Settings              Settings `json:"mattermostSettings,omitempty"`
	Remote                *remote.User
	OAuth2Token           *oauth2.Token
	PluginVersion         string
	MattermostUserID      string
	MattermostUsername    string
	MattermostDisplayName string
	LastStatus            string
	WelcomeFlowStatus     WelcomeFlowStatus `json:"mattermostFlags,omitempty"`
	ActiveEvents          []string          `json:"events"`
	ChannelEvents         ChannelEventLink  `json:"linkedEvents,omitempty"`
}

func (*User) Clone

func (user *User) Clone() *User

type UserIndex

type UserIndex []*UserShort

func (UserIndex) ByEmail

func (index UserIndex) ByEmail() map[string]*UserShort

func (UserIndex) ByMattermostID

func (index UserIndex) ByMattermostID() map[string]*UserShort

func (UserIndex) ByRemoteID

func (index UserIndex) ByRemoteID() map[string]*UserShort

func (UserIndex) GetMattermostUserIDs

func (index UserIndex) GetMattermostUserIDs() []string

func (UserIndex) ToDTO

func (index UserIndex) ToDTO() (result []UserShortDTO)

type UserShort

type UserShort struct {
	MattermostUsername    string `json:"mm_username"`
	MattermostDisplayName string `json:"mm_display_name"`
	MattermostUserID      string `json:"mm_id"`
	RemoteID              string `json:"remote_id"`
	Email                 string `json:"email"`
}

func (UserShort) Matches

func (us UserShort) Matches(term string) bool

func (UserShort) ToDTO

func (us UserShort) ToDTO() UserShortDTO

type UserShortDTO

type UserShortDTO struct {
	MattermostUserID      string `json:"mm_id"`
	MattermostUsername    string `json:"mm_username"`
	MattermostDisplayName string `json:"mm_display_name"`
}

type UserStore

type UserStore interface {
	LoadUser(mattermostUserID string) (*User, error)
	LoadMattermostUserID(remoteUserID string) (string, error)
	LoadUserIndex() (UserIndex, error)
	SearchInUserIndex(term string, limit int) (UserIndex, error)
	StoreUser(user *User) error
	LoadUserFromIndex(mattermostUserID string) (*UserShort, error)
	DeleteUser(mattermostUserID string) error
	ModifyUserIndex(modify func(userIndex UserIndex) (UserIndex, error)) error
	StoreUserInIndex(user *User) error
	DeleteUserFromIndex(mattermostUserID string) error
	StoreUserActiveEvents(mattermostUserID string, events []string) error
	StoreUserLinkedEvent(mattermostUserID, eventID, channelID string) error
}

type WelcomeFlowStatus

type WelcomeFlowStatus struct {
	PostIDs map[string]string
	Step    int
}

type WelcomeStore

type WelcomeStore interface {
	LoadUserWelcomePost(mattermostID string) (string, error)
	StoreUserWelcomePost(mattermostID, postID string) error
	DeleteUserWelcomePost(mattermostID string) (string, error)
}

Directories

Path Synopsis
Package mock_store is a generated GoMock package.
Package mock_store is a generated GoMock package.

Jump to

Keyboard shortcuts

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