| 1 | package slack |
| 2 | |
| 3 | const ( |
| 4 | DEFAULT_HISTORY_LATEST = "" |
| 5 | DEFAULT_HISTORY_OLDEST = "0" |
| 6 | DEFAULT_HISTORY_COUNT = 100 |
| 7 | DEFAULT_HISTORY_INCLUSIVE = false |
| 8 | DEFAULT_HISTORY_UNREADS = false |
| 9 | ) |
| 10 | |
| 11 | // HistoryParameters contains all the necessary information to help in the retrieval of history for Channels/Groups/DMs |
| 12 | type HistoryParameters struct { |
| 13 | Latest string |
| 14 | Oldest string |
| 15 | Count int |
| 16 | Inclusive bool |
| 17 | Unreads bool |
| 18 | } |
| 19 | |
| 20 | // History contains message history information needed to navigate a Channel / Group / DM history |
| 21 | type History struct { |
| 22 | Latest string `json:"latest"` |
| 23 | Messages []Message `json:"messages"` |
| 24 | HasMore bool `json:"has_more"` |
| 25 | Unread int `json:"unread_count_display"` |
| 26 | } |
| 27 | |
| 28 | // NewHistoryParameters provides an instance of HistoryParameters with all the sane default values set |
| 29 | func NewHistoryParameters() HistoryParameters { |
| 30 | return HistoryParameters{ |
| 31 | Latest: DEFAULT_HISTORY_LATEST, |
| 32 | Oldest: DEFAULT_HISTORY_OLDEST, |
| 33 | Count: DEFAULT_HISTORY_COUNT, |
| 34 | Inclusive: DEFAULT_HISTORY_INCLUSIVE, |
| 35 | Unreads: DEFAULT_HISTORY_UNREADS, |
| 36 | } |
| 37 | } |