18 lines
750 B
Smalltalk
18 lines
750 B
Smalltalk
accessing
|
|
userMentionsFor: username since: startDateString
|
|
| nextToken queryUrl sinceDate untilDate messages response |
|
|
|
|
sinceDate := 'start_time=',startDateString, 'T00:00:00Z'.
|
|
messages := OrderedCollection new.
|
|
nextToken := ''.
|
|
[ nextToken includesSubstring: 'stop' ] whileFalse: [
|
|
queryUrl := self usersBaseEndPoint,
|
|
(self userIDFrom: username), '/mentions', (self defaultQueryParameters at: 'mentionsOrig') ,
|
|
'&', sinceDate,
|
|
'&', nextToken.
|
|
response := STONJSON fromString: (self rawResponseForURL: queryUrl).
|
|
(response at: 'data') do: [:tweetData |
|
|
messages add: (Tweet new fromDictionary: tweetData)
|
|
].
|
|
nextToken := 'pagination_token=',((response at: 'meta') at: 'next_token' ifAbsent: [ 'stop' ])].
|
|
^ messages. |