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: 13 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 ErrNotFound = kvstore.ErrNotFound

Functions

This section is empty.

Types

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 EventStore

type EventStore interface {
	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 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
	LastStatus        string
	WelcomeFlowStatus WelcomeFlowStatus `json:"mattermostFlags,omitempty"`
	ActiveEvents      []string          `json:"events"`
}

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

type UserShort

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

type UserStore

type UserStore interface {
	LoadUser(mattermostUserID string) (*User, error)
	LoadMattermostUserID(remoteUserID string) (string, error)
	LoadUserIndex() (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
}

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