Codebase list golang-github-nlopes-slack / e9bad08
Add missing Unreads parameter Norberto Lopes 8 years ago
4 changed file(s) with 24 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
9696 values.Add("inclusive", "0")
9797 }
9898 }
99 if params.Unreads != DEFAULT_HISTORY_UNREADS {
100 if params.Unreads {
101 values.Add("unreads", "1")
102 } else {
103 values.Add("unreads", "0")
104 }
105 }
99106 response, err := channelRequest("channels.history", values, api.debug)
100107 if err != nil {
101108 return nil, err
130130 values.Add("inclusive", "0")
131131 }
132132 }
133 if params.Unreads != DEFAULT_HISTORY_UNREADS {
134 if params.Unreads {
135 values.Add("unreads", "1")
136 } else {
137 values.Add("unreads", "0")
138 }
139 }
133140 response, err := groupRequest("groups.history", values, api.debug)
134141 if err != nil {
135142 return nil, err
44 DEFAULT_HISTORY_OLDEST = "0"
55 DEFAULT_HISTORY_COUNT = 100
66 DEFAULT_HISTORY_INCLUSIVE = false
7 DEFAULT_HISTORY_UNREADS = false
78 )
89
910 // HistoryParameters contains all the necessary information to help in the retrieval of history for Channels/Groups/DMs
1213 Oldest string
1314 Count int
1415 Inclusive bool
16 Unreads bool
1517 }
1618
1719 // History contains message history information needed to navigate a Channel / Group / DM history
2830 Oldest: DEFAULT_HISTORY_OLDEST,
2931 Count: DEFAULT_HISTORY_COUNT,
3032 Inclusive: DEFAULT_HISTORY_INCLUSIVE,
33 Unreads: DEFAULT_HISTORY_UNREADS,
3134 }
3235 }
102102 values.Add("inclusive", "0")
103103 }
104104 }
105 if params.Unreads != DEFAULT_HISTORY_UNREADS {
106 if params.Unreads {
107 values.Add("unreads", "1")
108 } else {
109 values.Add("unreads", "0")
110 }
111 }
105112 response, err := imRequest("im.history", values, api.debug)
106113 if err != nil {
107114 return nil, err