summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/history.go
blob: 87b2e1ed84f9ee972dc214ce9777a469581dfb46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package slack

const (
	DEFAULT_HISTORY_LATEST    = ""
	DEFAULT_HISTORY_OLDEST    = "0"
	DEFAULT_HISTORY_COUNT     = 100
	DEFAULT_HISTORY_INCLUSIVE = false
	DEFAULT_HISTORY_UNREADS   = false
)

// HistoryParameters contains all the necessary information to help in the retrieval of history for Channels/Groups/DMs
type HistoryParameters struct {
	Latest    string
	Oldest    string
	Count     int
	Inclusive bool
	Unreads   bool
}

// History contains message history information needed to navigate a Channel / Group / DM history
type History struct {
	Latest   string    `json:"latest"`
	Messages []Message `json:"messages"`
	HasMore  bool      `json:"has_more"`
}

// NewHistoryParameters provides an instance of HistoryParameters with all the sane default values set
func NewHistoryParameters() HistoryParameters {
	return HistoryParameters{
		Latest:    DEFAULT_HISTORY_LATEST,
		Oldest:    DEFAULT_HISTORY_OLDEST,
		Count:     DEFAULT_HISTORY_COUNT,
		Inclusive: DEFAULT_HISTORY_INCLUSIVE,
		Unreads:   DEFAULT_HISTORY_UNREADS,
	}
}