app

package
v0.0.0-...-2de19fb Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TeamsSystemCode   = "teams"
	InputMessageCode  = "input"
	OutputMessageCode = "output"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	ProactiveChan chan *mesga.Turn
	SentChan      chan *mesga.Turn
	// contains filtered or unexported fields
}

func NewApp

func NewApp(
	cfg configs.Config,
	logger *logger.Logger,
	repo Repository,
) *App

func (*App) CreateProject

func (a *App) CreateProject(u *domain.User, p *domain.Project) (*domain.Project, error)

func (*App) CreateUser

func (a *App) CreateUser(u *domain.User) error

func (*App) GetOrCreateTeamsUser

func (a *App) GetOrCreateTeamsUser(turn mesga.Turn) (*domain.User, error)

func (*App) GetOrCreateTeamsUserDialog

func (a *App) GetOrCreateTeamsUserDialog(turn mesga.Turn, user *domain.User) (*domain.Dialog, error)

func (*App) GetUser

func (a *App) GetUser(u *domain.User) (*domain.User, error)

func (*App) GetUserAndDialog

func (a *App) GetUserAndDialog(turn mesga.Turn) (*domain.User, *domain.Dialog, error)

func (*App) GetUserProjects

func (a *App) GetUserProjects(u *domain.User) ([]*domain.Project, error)

func (*App) GetUserToken

func (a *App) GetUserToken(u *domain.User) (string, error)

func (*App) HandleInvoke

func (a *App) HandleInvoke(turn mesga.Turn) mesga.Turn

func (*App) HandleMessage

func (a *App) HandleMessage(turn mesga.Turn) (updatedTurn mesga.Turn)

func (*App) HandleUpdate

func (a *App) HandleUpdate(turn mesga.Turn) mesga.Turn

func (*App) ReadSentChannel

func (a *App) ReadSentChannel()

func (*App) SendProjectNotifications

func (a *App) SendProjectNotifications() error

SendProjectNotifications implementation sucks. It's only for testing.

func (*App) SendTeamsProactive

func (a *App) SendTeamsProactive(t *mesga.Turn) error

func (*App) StoreMessage

func (a *App) StoreMessage(turn mesga.Turn, dialog *domain.Dialog) error

func (*App) ValidateUserPassword

func (a *App) ValidateUserPassword(u *domain.User) (bool, error)

type CreateProjectPayload

type CreateProjectPayload struct {
	PayloadHeader
	Title   string
	DueDate string
}

CreateProjectPayload holds data for new project

type PayloadHeader

type PayloadHeader struct {
	App    string
	Action string
}

PayloadHeader holds common fields to identify payload

type Repository

type Repository interface {
	// users
	CreateUser(*domain.User) (*domain.User, error)
	GetUserByUsername(username string) (*domain.User, error)
	GetUserByTeamsID(teamsID string) (*domain.User, error)
	GetUserCount() (int, error)

	// messages
	CreateMessage(*domain.Message, *domain.Dialog, error) (*domain.Message, error)

	// dialog
	CreateDialog(*domain.User, *domain.Dialog) (*domain.Dialog, error)
	GetUserDialog(*domain.User) (*domain.Dialog, error)

	// projects
	CreateProject(*domain.User, *domain.Project) (*domain.Project, error)
	GetUserProjects(*domain.User) ([]*domain.Project, error)
	GetRandomProjectByUser() ([]*domain.Project, error) // for sample notifications
}

Jump to

Keyboard shortcuts

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