| 177 | ) |
| 178 | |
| 179 | func (r readResponse) parseNext() ([]GetActivitiesOption, error) { |
| 180 | if r.Next == "" { |
| 181 | return nil, ErrMissingNextPage |
| 182 | } |
| 183 | |
| 184 | urlParts := strings.Split(r.Next, "?") |
| 185 | if len(urlParts) != 2 { |
| 186 | return nil, ErrInvalidNextPage |
| 187 | } |
| 188 | values, err := url.ParseQuery(urlParts[1]) |
| 189 | if err != nil { |
| 190 | return nil, ErrInvalidNextPage |
| 191 | } |
| 192 | |
| 193 | var opts []GetActivitiesOption |
| 194 | |
| 195 | limit, ok, err := parseIntValue(values, "limit") |
| 196 | if err != nil { |
| 197 | return nil, err |
| 198 | } |
| 199 | if ok { |
| 200 | opts = append(opts, WithActivitiesLimit(limit)) |
| 201 | } |
| 202 | |
| 203 | offset, ok, err := parseIntValue(values, "offset") |
| 204 | if err != nil { |
| 205 | return nil, err |
| 206 | } |
| 207 | if ok { |
| 208 | opts = append(opts, WithActivitiesOffset(offset)) |
| 209 | } |
| 210 | |
| 211 | if idLT := values.Get("id_lt"); idLT != "" { |
| 212 | opts = append(opts, WithActivitiesIDLT(idLT)) |
| 213 | } |
| 214 | |
| 215 | if ranking := values.Get("ranking"); ranking != "" { |
| 216 | opts = append(opts, WithActivitiesRanking(ranking)) |
| 217 | } |
| 218 | |
| 219 | if enrichOpt := values.Get("withOwnReactions"); parseBool(enrichOpt) { |
| 220 | opts = append(opts, WithEnrichOwnReactions()) |
| 221 | } |
| 222 | |
| 223 | if enrichOpt := values.Get("user_id"); enrichOpt != "" { |
| 224 | opts = append(opts, WithEnrichUserReactions(enrichOpt)) |
| 225 | } |
| 226 | |
| 227 | if enrichOpt := values.Get("withFirstReactions"); parseBool(enrichOpt) { |
| 228 | opts = append(opts, WithEnrichFirstReactions()) |
| 229 | } |
| 230 | |
| 231 | if enrichOpt := values.Get("withRecentReactions"); parseBool(enrichOpt) { |
| 232 | opts = append(opts, WithEnrichRecentReactions()) |
| 233 | } |
| 234 | |
| 235 | if enrichOpt := values.Get("withReactionCounts"); parseBool(enrichOpt) { |
| 236 | opts = append(opts, WithEnrichReactionCounts()) |