mscalendar

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: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldSubject        = "Subject"
	FieldBodyPreview    = "BodyPreview"
	FieldImportance     = "Importance"
	FieldDuration       = "Duration"
	FieldWhen           = "When"
	FieldLocation       = "Location"
	FieldAttendees      = "Attendees"
	FieldOrganizer      = "Organizer"
	FieldResponseStatus = "ResponseStatus"
)
View Source
const (
	OptionYes          = "Yes"
	OptionNotResponded = "Not responded"
	OptionNo           = "No"
	OptionMaybe        = "Maybe"
)
View Source
const (
	ResponseYes   = "accepted"
	ResponseMaybe = "tentativelyAccepted"
	ResponseNo    = "declined"
	ResponseNone  = "notResponded"
)
View Source
const BotWelcomeMessage = "Bot user connected to account %s."
View Source
const DailySummaryJobInterval = 15 * time.Minute

Run daily summary job every 15 minutes

View Source
const RemoteUserAlreadyConnected = "" /* 132-byte string literal not displayed */
View Source
const RemoteUserAlreadyConnectedNotFound = "%s account `%s` is already mapped to a Mattermost account, but the Mattermost user could not be found"
View Source
const (
	StatusSyncJobInterval = 5 * time.Minute
)
View Source
const (
	WelcomeMessage = `Welcome to the Microsoft Calendar plugin.
	[Click here to link your account.](%s/oauth2/connect)`
)

Variables

This section is empty.

Functions

func NewDailySummarySetting

func NewDailySummarySetting(inStore settingspanel.SettingStore, getTimezone func(userID string) (string, error)) settingspanel.Setting

func NewNotificationsSetting

func NewNotificationsSetting(getCal func(string) MSCalendar) settingspanel.Setting

func NewOAuth2App

func NewOAuth2App(env Env) oauth2connect.App

func NewPostActionForEventResponse

func NewPostActionForEventResponse(eventID, response, url string) []*model.PostAction

func NewSettingsPanel

func NewSettingsPanel(bot bot.Bot, panelStore settingspanel.PanelStore, settingStore settingspanel.SettingStore, settingsHandler, pluginURL string, getCal func(userID string) MSCalendar) settingspanel.Panel

Types

type Availability

type Availability interface {
	GetCalendarViews(users []*store.User) ([]*remote.ViewCalendarResponse, error)
	Sync(mattermostUserID string) (string, *StatusSyncJobSummary, error)
	SyncAll() (string, *StatusSyncJobSummary, error)
}

type Bot

type Bot interface {
	bot.Bot
	Welcomer
	flow.Store
}

func NewMSCalendarBot

func NewMSCalendarBot(bot bot.Bot, env Env, pluginURL string) Bot

type Calendar

type Calendar interface {
	CreateCalendar(user *User, calendar *remote.Calendar) (*remote.Calendar, error)
	CreateEvent(user *User, event *remote.Event, mattermostUserIDs []string) (*remote.Event, error)
	DeleteCalendar(user *User, calendarID string) error
	FindMeetingTimes(user *User, meetingParams *remote.FindMeetingTimesParameters) (*remote.MeetingTimeSuggestionResults, error)
	GetCalendars(user *User) ([]*remote.Calendar, error)
	ViewCalendar(user *User, from, to time.Time) ([]*remote.Event, error)
}

type Client

type Client interface {
	MakeClient() (remote.Client, error)
	MakeSuperuserClient() (remote.Client, error)
}

type DailySummary

type DailySummary interface {
	GetDailySummaryForUser(user *User) (string, error)
	GetDailySummarySettingsForUser(user *User) (*store.DailySummaryUserSettings, error)
	SetDailySummaryPostTime(user *User, timeStr string) (*store.DailySummaryUserSettings, error)
	SetDailySummaryEnabled(user *User, enable bool) (*store.DailySummaryUserSettings, error)
	ProcessAllDailySummary(now time.Time) error
}

type Dependencies

type Dependencies struct {
	Logger            bot.Logger
	PluginAPI         PluginAPI
	Poster            bot.Poster
	Remote            remote.Remote
	Store             store.Store
	SettingsPanel     settingspanel.Panel
	IsAuthorizedAdmin func(string) (bool, error)
	Welcomer          Welcomer
	Tracker           tracker.Tracker
}

Dependencies contains all API dependencies

type Env

type Env struct {
	*config.Config
	*Dependencies
}

type EventResponder

type EventResponder interface {
	AcceptEvent(user *User, eventID string) error
	DeclineEvent(user *User, eventID string) error
	TentativelyAcceptEvent(user *User, eventID string) error
	RespondToEvent(user *User, eventID, response string) error
}

type MSCalendar

func New

func New(env Env, actingMattermostUserID string) MSCalendar

type NotificationProcessor

type NotificationProcessor interface {
	Configure(Env)
	Enqueue(notifications ...*remote.Notification) error
	Quit()
}

func NewNotificationProcessor

func NewNotificationProcessor(env Env) NotificationProcessor

type PluginAPI

type PluginAPI interface {
	GetMattermostUser(mattermostUserID string) (*model.User, error)
	GetMattermostUserByUsername(mattermostUsername string) (*model.User, error)
	GetMattermostUserStatus(mattermostUserID string) (*model.Status, error)
	GetMattermostUserStatusesByIds(mattermostUserIDs []string) ([]*model.Status, error)
	IsSysAdmin(mattermostUserID string) (bool, error)
	UpdateMattermostUserStatus(mattermostUserID, status string) (*model.Status, error)
	GetPost(postID string) (*model.Post, error)
}

type Settings

type Settings interface {
	PrintSettings(userID string)
	ClearSettingsPosts(userID string)
}

type StatusSyncJobSummary

type StatusSyncJobSummary struct {
	NumberOfUsersFailedStatusChanged int
	NumberOfUsersStatusChanged       int
	NumberOfUsersProcessed           int
}

type Subscriptions

type Subscriptions interface {
	CreateMyEventSubscription() (*store.Subscription, error)
	RenewMyEventSubscription() (*store.Subscription, error)
	DeleteOrphanedSubscription(ID string) error
	DeleteMyEventSubscription() error
	ListRemoteSubscriptions() ([]*remote.Subscription, error)
	LoadMyEventSubscription() (*store.Subscription, error)
}

type User

type User struct {
	*store.User
	MattermostUser   *model.User
	MattermostUserID string
}

func NewUser

func NewUser(mattermostUserID string) *User

func (*User) Clone

func (user *User) Clone() *User

func (*User) Markdown

func (user *User) Markdown() string

func (*User) String

func (user *User) String() string

type Users

type Users interface {
	GetActingUser() *User
	GetTimezone(user *User) (string, error)
	DisconnectUser(mattermostUserID string) error
	GetRemoteUser(mattermostUserID string) (*remote.User, error)
	IsAuthorizedAdmin(mattermostUserID string) (bool, error)
	GetUserSettings(user *User) (*store.Settings, error)
}

type WelcomeFlow

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

func NewWelcomeFlow

func NewWelcomeFlow(bot bot.FlowController, welcomer Welcomer) *WelcomeFlow

func (*WelcomeFlow) FlowDone

func (wf *WelcomeFlow) FlowDone(userID string)

func (*WelcomeFlow) Length

func (wf *WelcomeFlow) Length() int

func (*WelcomeFlow) Step

func (wf *WelcomeFlow) Step(i int) flow.Step

func (*WelcomeFlow) StepDone

func (wf *WelcomeFlow) StepDone(userID string, step int, value bool)

func (*WelcomeFlow) URL

func (wf *WelcomeFlow) URL() string

type Welcomer

type Welcomer interface {
	Welcome(userID string) error
	AfterSuccessfullyConnect(userID, userLogin string) error
	AfterDisconnect(userID string) error
	WelcomeFlowEnd(userID string)
}

Directories

Path Synopsis
Package mock_mscalendar is a generated GoMock package.
Package mock_mscalendar is a generated GoMock package.
Package mock_plugin_api is a generated GoMock package.
Package mock_plugin_api is a generated GoMock package.
Package mock_welcomer is a generated GoMock package.
Package mock_welcomer is a generated GoMock package.

Jump to

Keyboard shortcuts

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