2020-06-01 02:25:39 +02:00
|
|
|
import times, sequtils, options, tables
|
2019-09-08 13:01:20 +02:00
|
|
|
import prefs_impl
|
|
|
|
|
2020-05-08 02:48:47 +02:00
|
|
|
genPrefsType()
|
|
|
|
|
2019-08-06 19:02:38 +02:00
|
|
|
type
|
2020-06-01 02:25:39 +02:00
|
|
|
Token* = ref object
|
|
|
|
tok*: string
|
|
|
|
limit*: int
|
|
|
|
remaining*: int
|
|
|
|
reset*: Time
|
|
|
|
init*: Time
|
|
|
|
# agent*: string
|
|
|
|
|
|
|
|
Error* = enum
|
|
|
|
protectedUser = 22
|
|
|
|
couldntAuth = 32
|
|
|
|
doesntExist = 34
|
|
|
|
notFound = 50
|
|
|
|
suspended = 63
|
|
|
|
invalidToken = 89
|
|
|
|
listIdOrSlug = 112
|
|
|
|
forbidden = 200
|
|
|
|
noCsrf = 353
|
|
|
|
|
|
|
|
Profile* = object
|
|
|
|
id*: string
|
|
|
|
username*: string
|
|
|
|
fullname*: string
|
|
|
|
lowername*: string
|
|
|
|
location*: string
|
|
|
|
website*: string
|
|
|
|
bio*: string
|
|
|
|
userpic*: string
|
|
|
|
banner*: string
|
|
|
|
following*: string
|
|
|
|
followers*: string
|
|
|
|
tweets*: string
|
|
|
|
likes*: string
|
|
|
|
media*: string
|
|
|
|
verified*: bool
|
|
|
|
protected*: bool
|
|
|
|
suspended*: bool
|
|
|
|
joinDate*: Time
|
|
|
|
|
2019-08-06 19:02:38 +02:00
|
|
|
VideoType* = enum
|
2020-06-01 02:25:39 +02:00
|
|
|
m3u8 = "application/x-mpegURL"
|
|
|
|
mp4 = "video/mp4"
|
|
|
|
vmap = "video/vmap"
|
2019-08-06 19:02:38 +02:00
|
|
|
|
2020-06-01 02:25:39 +02:00
|
|
|
VideoVariant* = object
|
|
|
|
videoType*: VideoType
|
|
|
|
url*: string
|
|
|
|
bitrate*: int
|
|
|
|
|
|
|
|
Video* = object
|
|
|
|
videoId*: string
|
|
|
|
contentId*: string
|
|
|
|
durationMs*: int
|
|
|
|
url*: string
|
|
|
|
thumb*: string
|
|
|
|
views*: string
|
|
|
|
available*: bool
|
|
|
|
reason*: string
|
|
|
|
title*: string
|
|
|
|
description*: string
|
|
|
|
playbackType*: VideoType
|
|
|
|
variants*: seq[VideoVariant]
|
2019-09-08 12:22:52 +02:00
|
|
|
|
2019-07-11 19:22:23 +02:00
|
|
|
QueryKind* = enum
|
2019-10-08 13:54:20 +02:00
|
|
|
posts, replies, media, users, tweets, userList
|
2019-07-03 11:46:03 +02:00
|
|
|
|
|
|
|
Query* = object
|
2019-07-11 19:22:23 +02:00
|
|
|
kind*: QueryKind
|
2019-09-13 13:20:08 +02:00
|
|
|
text*: string
|
2019-07-04 11:55:19 +02:00
|
|
|
filters*: seq[string]
|
|
|
|
includes*: seq[string]
|
|
|
|
excludes*: seq[string]
|
2019-08-06 17:41:06 +02:00
|
|
|
fromUser*: seq[string]
|
2019-09-19 22:11:38 +02:00
|
|
|
since*: string
|
|
|
|
until*: string
|
2019-09-19 23:36:21 +02:00
|
|
|
near*: string
|
2019-07-04 11:55:19 +02:00
|
|
|
sep*: string
|
2019-07-03 11:46:03 +02:00
|
|
|
|
2019-06-24 05:14:14 +02:00
|
|
|
Gif* = object
|
|
|
|
url*: string
|
|
|
|
thumb*: string
|
|
|
|
|
2019-07-04 04:18:32 +02:00
|
|
|
GalleryPhoto* = object
|
|
|
|
url*: string
|
|
|
|
tweetId*: string
|
|
|
|
color*: string
|
|
|
|
|
2020-05-26 14:24:41 +02:00
|
|
|
PhotoRail* = seq[GalleryPhoto]
|
|
|
|
|
2019-06-29 14:11:23 +02:00
|
|
|
Poll* = object
|
|
|
|
options*: seq[string]
|
|
|
|
values*: seq[int]
|
2020-06-01 02:25:39 +02:00
|
|
|
votes*: int
|
2019-06-29 14:11:23 +02:00
|
|
|
leader*: int
|
2020-06-01 02:25:39 +02:00
|
|
|
status*: string
|
2019-06-29 14:11:23 +02:00
|
|
|
|
2019-07-11 19:22:23 +02:00
|
|
|
CardKind* = enum
|
2020-06-01 02:25:39 +02:00
|
|
|
player = "player"
|
2019-07-15 16:03:01 +02:00
|
|
|
summary = "summary"
|
|
|
|
summaryLarge = "summary_large_image"
|
|
|
|
promoWebsite = "promo_website"
|
|
|
|
promoVideo = "promo_video_website"
|
2019-11-08 22:52:34 +01:00
|
|
|
promoVideoConvo = "promo_video_convo"
|
2019-07-15 16:03:01 +02:00
|
|
|
liveEvent = "live_event"
|
2020-06-01 02:25:39 +02:00
|
|
|
broadcast = "broadcast"
|
|
|
|
periscope = "periscope_broadcast"
|
2019-07-11 19:22:23 +02:00
|
|
|
|
|
|
|
Card* = object
|
|
|
|
kind*: CardKind
|
|
|
|
id*: string
|
|
|
|
query*: string
|
|
|
|
url*: string
|
|
|
|
title*: string
|
|
|
|
dest*: string
|
|
|
|
text*: string
|
2020-06-01 02:25:39 +02:00
|
|
|
image*: string
|
2019-07-15 16:03:01 +02:00
|
|
|
video*: Option[Video]
|
2019-07-11 19:22:23 +02:00
|
|
|
|
2019-07-01 23:48:25 +02:00
|
|
|
TweetStats* = object
|
2020-05-26 14:24:41 +02:00
|
|
|
replies*: int
|
|
|
|
retweets*: int
|
|
|
|
likes*: int
|
2019-07-01 23:48:25 +02:00
|
|
|
|
2019-06-24 05:14:14 +02:00
|
|
|
Tweet* = ref object
|
2019-12-09 18:39:12 -05:00
|
|
|
id*: int64
|
|
|
|
threadId*: int64
|
2020-06-01 02:25:39 +02:00
|
|
|
replyId*: int64
|
2019-06-20 16:16:20 +02:00
|
|
|
profile*: Profile
|
|
|
|
text*: string
|
|
|
|
time*: Time
|
2019-07-02 00:52:50 +02:00
|
|
|
reply*: seq[string]
|
2019-06-20 16:16:20 +02:00
|
|
|
pinned*: bool
|
2019-07-02 00:52:50 +02:00
|
|
|
hasThread*: bool
|
2019-09-08 14:34:26 +02:00
|
|
|
available*: bool
|
|
|
|
tombstone*: string
|
2019-12-21 05:44:58 +01:00
|
|
|
location*: string
|
2019-07-01 23:48:25 +02:00
|
|
|
stats*: TweetStats
|
2020-06-01 02:25:39 +02:00
|
|
|
retweet*: Option[Tweet]
|
2019-10-26 16:37:58 +02:00
|
|
|
attribution*: Option[Profile]
|
2019-12-21 05:07:50 +01:00
|
|
|
mediaTags*: seq[Profile]
|
2020-06-01 02:25:39 +02:00
|
|
|
quote*: Option[Tweet]
|
2019-07-11 19:22:23 +02:00
|
|
|
card*: Option[Card]
|
2020-06-01 02:25:39 +02:00
|
|
|
poll*: Option[Poll]
|
2019-06-24 05:14:14 +02:00
|
|
|
gif*: Option[Gif]
|
|
|
|
video*: Option[Video]
|
|
|
|
photos*: seq[string]
|
2019-06-20 16:16:20 +02:00
|
|
|
|
2020-06-01 02:25:39 +02:00
|
|
|
Result*[T] = object
|
2020-04-29 18:09:13 +02:00
|
|
|
content*: seq[T]
|
2020-06-01 02:25:39 +02:00
|
|
|
top*, bottom*: string
|
2020-04-29 18:09:13 +02:00
|
|
|
beginning*: bool
|
|
|
|
query*: Query
|
|
|
|
|
2020-06-01 02:25:39 +02:00
|
|
|
Chain* = object
|
2019-08-23 02:15:25 +02:00
|
|
|
content*: seq[Tweet]
|
2019-12-09 18:39:12 -05:00
|
|
|
more*: int64
|
2020-06-01 02:25:39 +02:00
|
|
|
cursor*: string
|
2019-06-20 16:16:20 +02:00
|
|
|
|
2019-06-24 05:14:14 +02:00
|
|
|
Conversation* = ref object
|
2019-06-20 16:16:20 +02:00
|
|
|
tweet*: Tweet
|
2019-10-08 20:47:45 +02:00
|
|
|
before*: Chain
|
|
|
|
after*: Chain
|
|
|
|
replies*: Result[Chain]
|
2019-06-20 16:16:20 +02:00
|
|
|
|
2019-08-23 02:15:25 +02:00
|
|
|
Timeline* = Result[Tweet]
|
2019-06-25 07:36:36 +02:00
|
|
|
|
2020-06-01 02:25:39 +02:00
|
|
|
List* = object
|
|
|
|
id*: string
|
|
|
|
name*: string
|
|
|
|
userId*: string
|
|
|
|
username*: string
|
|
|
|
description*: string
|
|
|
|
members*: int
|
|
|
|
banner*: string
|
|
|
|
|
|
|
|
GlobalObjects* = ref object
|
|
|
|
tweets*: Table[string, Tweet]
|
|
|
|
users*: Table[string, Profile]
|
|
|
|
|
2019-07-31 02:15:43 +02:00
|
|
|
Config* = ref object
|
|
|
|
address*: string
|
|
|
|
port*: int
|
2019-08-19 03:02:34 +02:00
|
|
|
useHttps*: bool
|
2019-07-31 02:15:43 +02:00
|
|
|
staticDir*: string
|
2019-10-21 05:19:00 +02:00
|
|
|
title*: string
|
|
|
|
hostname*: string
|
2019-07-31 02:15:43 +02:00
|
|
|
cacheDir*: string
|
|
|
|
profileCacheTime*: int
|
2019-10-24 00:17:38 +02:00
|
|
|
hmacKey*: string
|
2019-07-31 02:15:43 +02:00
|
|
|
|
2019-10-08 20:47:45 +02:00
|
|
|
proc contains*(thread: Chain; tweet: Tweet): bool =
|
2019-08-23 02:15:25 +02:00
|
|
|
thread.content.anyIt(it.id == tweet.id)
|