Improving TwitterUser data collection and views.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-08-21 20:52:32 -05:00
parent 11b95e0b19
commit 764078a241
6 changed files with 25 additions and 2 deletions

View File

@ -3,6 +3,6 @@ userEndPointFor: username selecting: tweetsOrMentions
"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, if present, should be YYYY-MM-DD."
| commonQueryParameters userFields |
userFields := 'user.fields=username,name,description,profile_image_url'.
userFields := 'user.fields=username,name,description,profile_image_url,created_at'.
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&', userFields, '&max_results=100'.
^ self usersBaseEndPoint, (self userIDFrom: username), '/', tweetsOrMentions, commonQueryParameters

View File

@ -0,0 +1,15 @@
accessing
asCardElement
^ BrHorizontalPane new
hFitContent;
vFitContent;
padding: (BlInsets all: 20);
margin: (BlInsets all: 10);
addChild: (self profileImage asElement asScalableElement size: 64@64);
addChild: (BrVerticalPane new
fitContent;
margin: (BlInsets left: 20);
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: '@', self userName);
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self name);
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: 'joined: ', self createdAtShorted));
when: BlClickEvent do: [:e | e target phlow spawnObject: self]

View File

@ -0,0 +1,3 @@
accessing
createdAt
^ createdAt

View File

@ -0,0 +1,3 @@
accessing
createdAtShorted
^ self createdAt copyFrom: 1 to: 7

View File

@ -3,5 +3,6 @@ fromDictionary: userDict
id := userDict at: 'id'.
name := userDict at: 'name'.
userName := userDict at: 'username'.
createdAt := userDict at: 'created_at'.
profileImageUrl := userDict at: 'profile_image_url'.
description := userDict at: 'description'.

View File

@ -12,7 +12,8 @@
"profileImageUrl",
"description",
"metrics",
"tweets"
"tweets",
"createdAt"
],
"name" : "TwitterUser",
"type" : "normal"