mind

package
v0.0.0-...-bb3eb04 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrContentTypeNotSupported is returned if the specified content type isn't supported
	ErrContentTypeNotSupported = status.New(codes.InvalidArgument, "content type not supported")
	// ErrStatementNotHandled is returned if a particular handler fails to process the statement
	ErrStatementNotHandled = status.New(codes.FailedPrecondition, "statement not handled")
	// ErrStatementIgnored is returned if no registered handlers chose to process the statement
	ErrStatementIgnored = status.New(codes.InvalidArgument, "statement not handled")
	// ErrStatementDisallowed is returned if the requesting user cannot make this statement
	ErrStatementDisallowed = status.New(codes.PermissionDenied, "statement user cannot make this request")
)

Functions

This section is empty.

Types

type Channel

type Channel interface {
	SendStatement(context.Context, *Statement) error
}

Channel represents a public or private shared communication location.

type Domotics

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

Domotics is a device-request handler

func NewDomotics

func NewDomotics(logger *zap.Logger, svc *Service, bridgeClient bridge.BridgeServiceClient) *Domotics

NewDomotics creates a new domotics handler

func (*Domotics) Monitor

func (d *Domotics) Monitor(ctx context.Context)

Monitor is used to track changes to devices

func (*Domotics) ProcessStatement

func (d *Domotics) ProcessStatement(ctx context.Context, req *SendStatementRequest) (*Statement, error)

ProcessStatement implements the handler interface. Logs and returns the statement.

type Echo

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

Echo is an echo handler

func NewEcho

func NewEcho(logger *zap.Logger) *Echo

NewEcho creates a new echo handler

func (*Echo) ProcessStatement

func (e *Echo) ProcessStatement(ctx context.Context, req *SendStatementRequest) (*Statement, error)

ProcessStatement implements the handler interface. Logs and returns the statement.

type Handler

type Handler interface {
	ProcessStatement(context.Context, *SendStatementRequest) (*Statement, error)
}

Handler describes an implementation to process statements and potentially take actions on them

type News

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

News is a news-request handler

func NewNews

func NewNews(logger *zap.Logger, client news.NewsServiceClient) *News

NewNews creates a new news handler

func (*News) ProcessStatement

func (n *News) ProcessStatement(ctx context.Context, req *SendStatementRequest) (*Statement, error)

ProcessStatement implements the handler interface. Logs and returns the statement.

type Service

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

Service is a messaging service.

func NewService

func NewService(logger *zap.Logger, users map[string]*users.User) *Service

NewService creates a new messaging service.

func (*Service) BroadcastUpdate

func (s *Service) BroadcastUpdate(ctx context.Context, statement *Statement) error

BroadcastUpdate sends a specified statement update to all registered handlers.

func (*Service) ReceiveStatements

func (s *Service) ReceiveStatements(*ReceiveStatementsRequest, MessageService_ReceiveStatementsServer) error

ReceiveStatements is used to broadcast info a receiver.

func (*Service) RegisterChannel

func (s *Service) RegisterChannel(c Channel)

RegisterChannel adds another implementation to the broadcast chain.

func (*Service) RegisterHandler

func (s *Service) RegisterHandler(handler Handler)

RegisterHandler adds another implementation to the call chain.

func (*Service) RegisterUser

func (s *Service) RegisterUser(context.Context, *RegisterUserRequest) (*users.User, error)

RegisterUser adds another user/endpoint mapping.

func (*Service) SendStatement

func (s *Service) SendStatement(ctx context.Context, req *SendStatementRequest) (*Statement, error)

SendStatement takes a supplied statement and passes it into the handler chain.

type SlackBot

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

SlackBot is a message service implementation.

func NewSlackBot

func NewSlackBot(logger *zap.Logger, s *Service, api *slack.Client, mgmtChannel string) *SlackBot

NewSlackBot creates a new slackbot using the supplied slack implementation.

func (*SlackBot) Run

func (sb *SlackBot) Run()

Run begins the event loop and monitors messages sent to the management channel.

func (*SlackBot) SendStatement

func (sb *SlackBot) SendStatement(ctx context.Context, statement *Statement) error

SendStatement is used to send a notification to the management channel.

type Transit

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

Transit is a transit-request handler

func NewTransit

func NewTransit(logger *zap.Logger, client transit.TransitServiceClient) *Transit

NewTransit creates a new transit handler

func (*Transit) ProcessStatement

func (t *Transit) ProcessStatement(ctx context.Context, req *SendStatementRequest) (*Statement, error)

ProcessStatement implements the handler interface. Logs and returns the statement.

type Weather

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

Weather is a weather-request handler

func NewWeather

func NewWeather(logger *zap.Logger, client weather.WeatherServiceClient, lat float64, lon float64) *Weather

NewWeather creates a new weather handler

func (*Weather) ProcessStatement

func (w *Weather) ProcessStatement(ctx context.Context, req *SendStatementRequest) (*Statement, error)

ProcessStatement implements the handler interface. Logs and returns the statement.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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