Skip to content

Commit 06a1def

Browse files
authored
fix: missing fields (#7)
2 parents 6205218 + 846183d commit 06a1def

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/jsons/timeline.nim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ proc formatUserAsJson*(user: User): JsonNode =
3535

3636
proc formatTweetAsJson*(tweet: Tweet): JsonNode =
3737
return %*{
38-
"id": tweet.id,
39-
"threadId": tweet.threadId,
40-
"replyId": tweet.replyId,
38+
"id": $tweet.id,
39+
"threadId": $tweet.threadId,
40+
"replyId": $tweet.replyId,
4141
"user": formatUserAsJson(tweet.user),
4242
"text": tweet.text,
4343
"time": tweet.time.toTime.toUnix(),
@@ -58,8 +58,10 @@ proc formatTweetAsJson*(tweet: Tweet): JsonNode =
5858
tweet.retweet)) else: newJNull(),
5959
"attribution": if tweet.attribution.isSome: formatUserAsJson(get(
6060
tweet.attribution)) else: newJNull(),
61+
"mediaTags": if tweet.mediaTags.len > 0: %tweet.mediaTags.map(formatUserAsJson) else: newJNull(),
6162
"quote": if tweet.quote.isSome: formatTweetAsJson(get(
6263
tweet.quote)) else: newJNull(),
64+
"card": if tweet.card.isSome: %*get(tweet.card) else: newJNull(),
6365
"poll": if tweet.poll.isSome: %*get(tweet.poll) else: newJNull(),
6466
"gif": if tweet.gif.isSome: %*get(tweet.gif) else: newJNull(),
6567
"video": if tweet.video.isSome: %*get(tweet.video) else: newJNull(),

0 commit comments

Comments
 (0)