app

package
v0.0.0-...-cb22eb2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2016 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	THUMBS_UP   = ":+1:\n"
	THUMBS_DOWN = ":-1:\n"
	USAGE       = "*Usage*:\n" +
		"        `wb [command] [text...]`\n" +
		"    where commands include:\n" +
		"*Registration Command*\n" +
		"        `register`, `r` - followed by <standup_id>, registers current channel to Whiteboard's standup id\n" +
		"\n" +
		"*Presentation Command*\n" +
		"		 `present`, `p` - presents today's standup. Follow with number of days to limit the entries shown by date (i.e. `wb p 2` will only return entries for the next 2 days)\n" +
		"\n" +
		"*Create Commands*\n" +
		"        `faces`, `f` - followed by a title, creates a new faces entry\n" +
		"        `interestings`, `i` - followed by a title, creates a new interestings entry\n" +
		"        `helps`, `h` - followed by a title, creates a new helps entry\n" +
		"        `events`, `e` - followed by a title, creates a new events entry\n" +
		"\n" +
		"*Detail Commands* (updates details of a started entry)\n" +
		"        `title`, `t`, `name`, `n` - updates a name/title detail to a started entry\n" +
		"        `body`, `b` - updates a body detail to a started entry\n" +
		"        `date`, `d` - updates a date detail to a started entry (YYYY-MM-DD)\n" +
		"\n" +
		"Example:\n" +
		"        `wb f New Face!` - will create a new face with the name 'New Face!'\n" +
		"        `wb d 2015-01-02` - will update the new face date to 02 Jan 2015"
)

Variables

This section is empty.

Functions

func GetAuthor

func GetAuthor(user *slack.User) (realName string)

func NewPool

func NewPool() *redis.Pool

func PostEntryToWhiteboard

func PostEntryToWhiteboard(restClient RestClient, entryType EntryType) (itemId string, ok bool)

Types

type RealRestClient

type RealRestClient struct{}

func (RealRestClient) GetStandup

func (RealRestClient) GetStandup(standupId string) (standup Standup, ok bool)

func (RealRestClient) GetStandupItems

func (RealRestClient) GetStandupItems(standupId int) (items StandupItems, ok bool)

func (RealRestClient) Post

func (RealRestClient) Post(request WhiteboardRequest) (itemId string, ok bool)

type RealStore

type RealStore struct {
	Pool *redis.Pool
}

func (*RealStore) Get

func (store *RealStore) Get(key string) (value string, ok bool)

func (*RealStore) GetStandup

func (store *RealStore) GetStandup(channel string) (standup Standup, ok bool)

func (*RealStore) Set

func (store *RealStore) Set(key string, value string)

func (*RealStore) SetStandup

func (store *RealStore) SetStandup(channel string, standup Standup)

type RestClient

type RestClient interface {
	Post(request WhiteboardRequest) (itemId string, ok bool)
	GetStandupItems(standupId int) (items StandupItems, ok bool)
	GetStandup(standupId string) (standup Standup, ok bool)
}

type Slack

type Slack struct {
	SlackRtm *slack.RTM
}

func (*Slack) GetChannelDetails

func (slackClient *Slack) GetChannelDetails(channel string) *slack.Channel

func (*Slack) GetUserDetails

func (slackClient *Slack) GetUserDetails(user string) (slackUser SlackUser)

func (*Slack) PostEntry

func (slackClient *Slack) PostEntry(entry *model.Entry, channel string, status string)

func (*Slack) PostMessage

func (slackClient *Slack) PostMessage(message string, channel string, status string)

func (*Slack) PostMessageWithMarkdown

func (slackClient *Slack) PostMessageWithMarkdown(message string, channel string, status string)

type SlackClient

type SlackClient interface {
	PostMessage(message string, channel string, status string)
	PostMessageWithMarkdown(message string, channel string, status string)
	PostEntry(entry *model.Entry, channel string, status string)
	GetUserDetails(user string) (slackUser SlackUser)
	GetChannelDetails(channel string) (slackChannel *slack.Channel)
}

type SlackUser

type SlackUser struct {
	Username string
	Author   string
	TimeZone string
}

type Store

type Store interface {
	Get(key string) (value string, ok bool)
	Set(key string, value string)
	GetStandup(channel string) (standup Standup, ok bool)
	SetStandup(channel string, standup Standup)
}

type WhiteboardApp

type WhiteboardApp struct {
	SlackClient SlackClient
	RestClient  RestClient
	Clock       Clock
	Store       Store
	EntryMap    map[string]EntryType
	CommandMap  map[string]func(input string, ev *slack.MessageEvent)
}

func NewWhiteboard

func NewWhiteboard(slackClient SlackClient, restClient RestClient, clock Clock, store Store) (whiteboard WhiteboardApp)

func (WhiteboardApp) FilterOutOld

func (whiteboard WhiteboardApp) FilterOutOld(entries []Entry, numDays int, userTimeZone string) []Entry

func (WhiteboardApp) ParseMessageEvent

func (whiteboard WhiteboardApp) ParseMessageEvent(ev *slack.MessageEvent)

Jump to

Keyboard shortcuts

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