Improving End Points.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-07-18 09:36:34 -05:00
parent 78cc29b7d6
commit eb23f2e9a0
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,8 @@
as yet unclassified
userEndPointFor: username selecting: tweetsOrMentions since: dateString
"I build a shared URL for querying last 100 mentions or tweets for a particular user.
Second parameter should be only 'tweets' or 'mentions', dateString should be YYYY-MM-DD."
| commonQueryParameters |
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&user.fields=username&max_results=100',
'&start_time=', dateString,'T00:00:00Z&'.
^ self usersBaseEndPoint, (self userIDFrom: username), '/', tweetsOrMentions, commonQueryParameters

View File

@ -2,6 +2,6 @@ accessing
userTweetsFrom: username userTweetsFrom: username
| rawResponse queryURL | | rawResponse queryURL |
"The following query gets the last 100 tweets, that is the maximun allowed for a particular user without pagination:" "The following query gets the last 100 tweets, that is the maximun allowed for a particular user without pagination:"
queryURL := self usersBaseEndPoint, (self userIDFrom: username), '/tweets', self defaultQueryParameters. queryURL := self usersBaseEndPoint, (self userIDFrom: username), '/tweets', self defaultQueryParameters at: 'tweets'.
rawResponse := self rawResponseForURL:queryURL. rawResponse := self rawResponseForURL:queryURL.
^ (STONJSON fromString: rawResponse) ^ (STONJSON fromString: rawResponse)