rettiwt-api 5.0.0-alpha.0 → 5.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (465) hide show
  1. package/.eslintrc.js +2 -3
  2. package/.github/workflows/documentation.yml +1 -1
  3. package/.github/workflows/publish-alpha.yml +1 -1
  4. package/.github/workflows/publish.yml +1 -1
  5. package/.prettierignore +1 -1
  6. package/.tool-versions +1 -1
  7. package/README.md +100 -100
  8. package/dist/Rettiwt.d.ts +10 -3
  9. package/dist/Rettiwt.js +31 -12
  10. package/dist/Rettiwt.js.map +1 -1
  11. package/dist/cli.js +8 -11
  12. package/dist/cli.js.map +1 -1
  13. package/dist/collections/Extractors.d.ts +36 -2
  14. package/dist/collections/Extractors.js +41 -69
  15. package/dist/collections/Extractors.js.map +1 -1
  16. package/dist/collections/Groups.js +5 -1
  17. package/dist/collections/Groups.js.map +1 -1
  18. package/dist/collections/Requests.d.ts +3 -3
  19. package/dist/collections/Requests.js +41 -40
  20. package/dist/collections/Requests.js.map +1 -1
  21. package/dist/commands/List.js +21 -78
  22. package/dist/commands/List.js.map +1 -1
  23. package/dist/commands/Tweet.js +214 -373
  24. package/dist/commands/Tweet.js.map +1 -1
  25. package/dist/commands/User.js +138 -305
  26. package/dist/commands/User.js.map +1 -1
  27. package/dist/enums/Authentication.d.ts +10 -0
  28. package/dist/enums/Authentication.js +15 -0
  29. package/dist/enums/Authentication.js.map +1 -0
  30. package/dist/enums/Data.d.ts +3 -3
  31. package/dist/enums/Data.js +3 -3
  32. package/dist/enums/Media.d.ts +10 -0
  33. package/dist/enums/Media.js +15 -0
  34. package/dist/enums/Media.js.map +1 -0
  35. package/dist/enums/Notification.d.ts +12 -0
  36. package/dist/enums/Notification.js +17 -0
  37. package/dist/enums/Notification.js.map +1 -0
  38. package/dist/enums/Resource.d.ts +4 -0
  39. package/dist/enums/Resource.js +4 -0
  40. package/dist/enums/Resource.js.map +1 -1
  41. package/dist/enums/raw/Analytics.d.ts +28 -0
  42. package/dist/enums/raw/Analytics.js +34 -0
  43. package/dist/enums/raw/Analytics.js.map +1 -0
  44. package/dist/enums/raw/Media.d.ts +10 -0
  45. package/dist/enums/raw/Media.js +15 -0
  46. package/dist/enums/raw/Media.js.map +1 -0
  47. package/dist/enums/raw/Notification.d.ts +11 -0
  48. package/dist/enums/raw/Notification.js +16 -0
  49. package/dist/enums/raw/Notification.js.map +1 -0
  50. package/dist/enums/raw/Tweet.d.ts +9 -0
  51. package/dist/enums/raw/Tweet.js +14 -0
  52. package/dist/enums/raw/Tweet.js.map +1 -0
  53. package/dist/helper/CliUtils.js +1 -2
  54. package/dist/helper/CliUtils.js.map +1 -1
  55. package/dist/helper/JsonUtils.js +6 -11
  56. package/dist/helper/JsonUtils.js.map +1 -1
  57. package/dist/helper/TidUtils.d.ts +2 -0
  58. package/dist/helper/TidUtils.js +162 -0
  59. package/dist/helper/TidUtils.js.map +1 -0
  60. package/dist/index.d.ts +75 -5
  61. package/dist/index.js +26 -6
  62. package/dist/index.js.map +1 -1
  63. package/dist/models/RettiwtConfig.d.ts +28 -0
  64. package/dist/models/RettiwtConfig.js +55 -0
  65. package/dist/models/RettiwtConfig.js.map +1 -0
  66. package/dist/models/args/FetchArgs.d.ts +16 -102
  67. package/dist/models/args/FetchArgs.js +105 -407
  68. package/dist/models/args/FetchArgs.js.map +1 -1
  69. package/dist/models/args/PostArgs.d.ts +16 -73
  70. package/dist/models/args/PostArgs.js +43 -236
  71. package/dist/models/args/PostArgs.js.map +1 -1
  72. package/dist/models/auth/AuthCookie.d.ts +21 -0
  73. package/dist/models/auth/AuthCookie.js +55 -0
  74. package/dist/models/auth/AuthCookie.js.map +1 -0
  75. package/dist/models/auth/AuthCredential.d.ts +30 -0
  76. package/dist/models/auth/AuthCredential.js +78 -0
  77. package/dist/models/auth/AuthCredential.js.map +1 -0
  78. package/dist/models/data/CursoredData.d.ts +5 -15
  79. package/dist/models/data/CursoredData.js +25 -32
  80. package/dist/models/data/CursoredData.js.map +1 -1
  81. package/dist/models/data/List.d.ts +7 -9
  82. package/dist/models/data/List.js +24 -4
  83. package/dist/models/data/List.js.map +1 -1
  84. package/dist/models/data/Notification.d.ts +10 -24
  85. package/dist/models/data/Notification.js +38 -36
  86. package/dist/models/data/Notification.js.map +1 -1
  87. package/dist/models/data/Tweet.d.ts +34 -31
  88. package/dist/models/data/Tweet.js +186 -112
  89. package/dist/models/data/Tweet.js.map +1 -1
  90. package/dist/models/data/User.d.ts +19 -23
  91. package/dist/models/data/User.js +92 -32
  92. package/dist/models/data/User.js.map +1 -1
  93. package/dist/models/errors/ApiError.js +8 -24
  94. package/dist/models/errors/ApiError.js.map +1 -1
  95. package/dist/models/errors/HttpError.js +8 -24
  96. package/dist/models/errors/HttpError.js.map +1 -1
  97. package/dist/models/errors/RettiwtError.d.ts +3 -2
  98. package/dist/models/errors/RettiwtError.js +8 -25
  99. package/dist/models/errors/RettiwtError.js.map +1 -1
  100. package/dist/models/errors/TimeoutError.js +5 -22
  101. package/dist/models/errors/TimeoutError.js.map +1 -1
  102. package/dist/models/params/Variables.d.ts +41 -0
  103. package/dist/models/params/Variables.js +61 -0
  104. package/dist/models/params/Variables.js.map +1 -0
  105. package/dist/requests/List.d.ts +24 -0
  106. package/dist/requests/List.js +122 -0
  107. package/dist/requests/List.js.map +1 -0
  108. package/dist/requests/Media.d.ts +21 -0
  109. package/dist/requests/Media.js +70 -0
  110. package/dist/requests/Media.js.map +1 -0
  111. package/dist/requests/Tweet.d.ts +75 -0
  112. package/dist/requests/Tweet.js +480 -0
  113. package/dist/requests/Tweet.js.map +1 -0
  114. package/dist/requests/User.d.ts +111 -0
  115. package/dist/requests/User.js +762 -0
  116. package/dist/requests/User.js.map +1 -0
  117. package/dist/services/internal/AuthService.d.ts +60 -0
  118. package/dist/services/internal/AuthService.js +106 -0
  119. package/dist/services/internal/AuthService.js.map +1 -0
  120. package/dist/services/internal/ErrorService.js +38 -40
  121. package/dist/services/internal/ErrorService.js.map +1 -1
  122. package/dist/services/internal/LogService.d.ts +0 -6
  123. package/dist/services/internal/LogService.js +12 -32
  124. package/dist/services/internal/LogService.js.map +1 -1
  125. package/dist/services/internal/TidService.d.ts +44 -0
  126. package/dist/services/internal/TidService.js +162 -0
  127. package/dist/services/internal/TidService.js.map +1 -0
  128. package/dist/services/public/FetcherService.d.ts +22 -19
  129. package/dist/services/public/FetcherService.js +126 -153
  130. package/dist/services/public/FetcherService.js.map +1 -1
  131. package/dist/services/public/ListService.d.ts +2 -2
  132. package/dist/services/public/ListService.js +31 -100
  133. package/dist/services/public/ListService.js.map +1 -1
  134. package/dist/services/public/TweetService.d.ts +63 -10
  135. package/dist/services/public/TweetService.js +255 -387
  136. package/dist/services/public/TweetService.js.map +1 -1
  137. package/dist/services/public/UserService.d.ts +4 -4
  138. package/dist/services/public/UserService.js +199 -386
  139. package/dist/services/public/UserService.js.map +1 -1
  140. package/dist/types/RettiwtConfig.d.ts +17 -10
  141. package/dist/types/args/FetchArgs.d.ts +123 -0
  142. package/dist/types/{ReturnTypes.js → args/FetchArgs.js} +1 -1
  143. package/dist/types/args/FetchArgs.js.map +1 -0
  144. package/dist/types/args/PostArgs.d.ts +100 -0
  145. package/dist/types/args/PostArgs.js +3 -0
  146. package/dist/types/args/PostArgs.js.map +1 -0
  147. package/dist/types/auth/AuthCookie.d.ts +15 -0
  148. package/dist/types/auth/AuthCookie.js +3 -0
  149. package/dist/types/auth/AuthCookie.js.map +1 -0
  150. package/dist/types/auth/AuthCredential.d.ts +23 -0
  151. package/dist/types/auth/AuthCredential.js +3 -0
  152. package/dist/types/auth/AuthCredential.js.map +1 -0
  153. package/dist/types/auth/TidDynamicArgs.d.ts +10 -0
  154. package/dist/types/auth/TidDynamicArgs.js +3 -0
  155. package/dist/types/auth/TidDynamicArgs.js.map +1 -0
  156. package/dist/types/auth/TidHeader.d.ts +8 -0
  157. package/dist/types/auth/TidHeader.js +3 -0
  158. package/dist/types/auth/TidHeader.js.map +1 -0
  159. package/dist/types/auth/TidParams.d.ts +27 -0
  160. package/dist/types/auth/TidParams.js +3 -0
  161. package/dist/types/auth/TidParams.js.map +1 -0
  162. package/dist/types/auth/TidProvider.d.ts +18 -0
  163. package/dist/types/auth/TidProvider.js +3 -0
  164. package/dist/types/auth/TidProvider.js.map +1 -0
  165. package/dist/types/data/CursoredData.d.ts +16 -0
  166. package/dist/types/data/CursoredData.js +3 -0
  167. package/dist/types/data/CursoredData.js.map +1 -0
  168. package/dist/types/data/List.d.ts +21 -0
  169. package/dist/types/data/List.js +3 -0
  170. package/dist/types/data/List.js.map +1 -0
  171. package/dist/types/data/Notification.d.ts +20 -0
  172. package/dist/types/data/Notification.js +3 -0
  173. package/dist/types/data/Notification.js.map +1 -0
  174. package/dist/types/data/Tweet.d.ts +71 -0
  175. package/dist/types/data/Tweet.js +3 -0
  176. package/dist/types/data/Tweet.js.map +1 -0
  177. package/dist/types/data/User.d.ts +35 -0
  178. package/dist/types/data/User.js +3 -0
  179. package/dist/types/data/User.js.map +1 -0
  180. package/dist/types/params/Variables.d.ts +27 -0
  181. package/dist/types/params/Variables.js +3 -0
  182. package/dist/types/params/Variables.js.map +1 -0
  183. package/dist/types/raw/base/Analytic.d.ts +21 -0
  184. package/dist/types/raw/base/Analytic.js +4 -0
  185. package/dist/types/raw/base/Analytic.js.map +1 -0
  186. package/dist/types/raw/base/Cursor.d.ts +11 -0
  187. package/dist/types/raw/base/Cursor.js +4 -0
  188. package/dist/types/raw/base/Cursor.js.map +1 -0
  189. package/dist/types/raw/base/LimitedVisibilityTweet.d.ts +32 -0
  190. package/dist/types/raw/base/LimitedVisibilityTweet.js +4 -0
  191. package/dist/types/raw/base/LimitedVisibilityTweet.js.map +1 -0
  192. package/dist/types/raw/base/List.d.ts +43 -0
  193. package/dist/types/raw/base/List.js +4 -0
  194. package/dist/types/raw/base/List.js.map +1 -0
  195. package/dist/types/raw/base/Media.d.ts +43 -0
  196. package/dist/types/raw/base/Media.js +4 -0
  197. package/dist/types/raw/base/Media.js.map +1 -0
  198. package/dist/types/raw/base/Notification.d.ts +53 -0
  199. package/dist/types/raw/base/Notification.js +4 -0
  200. package/dist/types/raw/base/Notification.js.map +1 -0
  201. package/dist/types/raw/base/Space.d.ts +32 -0
  202. package/dist/types/raw/base/Space.js +4 -0
  203. package/dist/types/raw/base/Space.js.map +1 -0
  204. package/dist/types/raw/base/Tweet.d.ts +119 -0
  205. package/dist/types/raw/base/Tweet.js +4 -0
  206. package/dist/types/raw/base/Tweet.js.map +1 -0
  207. package/dist/types/raw/base/User.d.ts +140 -0
  208. package/dist/types/raw/base/User.js +4 -0
  209. package/dist/types/raw/base/User.js.map +1 -0
  210. package/dist/types/raw/composite/DataResult.d.ts +8 -0
  211. package/dist/types/raw/composite/DataResult.js +3 -0
  212. package/dist/types/raw/composite/DataResult.js.map +1 -0
  213. package/dist/types/raw/composite/TimelineTweet.d.ts +11 -0
  214. package/dist/types/raw/composite/TimelineTweet.js +4 -0
  215. package/dist/types/raw/composite/TimelineTweet.js.map +1 -0
  216. package/dist/types/raw/composite/TimelineUser.d.ts +10 -0
  217. package/dist/types/raw/composite/TimelineUser.js +4 -0
  218. package/dist/types/raw/composite/TimelineUser.js.map +1 -0
  219. package/dist/types/raw/generic/Error.d.ts +30 -0
  220. package/dist/types/raw/generic/Error.js +3 -0
  221. package/dist/types/raw/generic/Error.js.map +1 -0
  222. package/dist/types/raw/generic/Response.d.ts +12 -0
  223. package/dist/types/raw/generic/Response.js +3 -0
  224. package/dist/types/raw/generic/Response.js.map +1 -0
  225. package/dist/types/raw/list/Details.d.ts +122 -0
  226. package/dist/types/raw/list/Details.js +4 -0
  227. package/dist/types/raw/list/Details.js.map +1 -0
  228. package/dist/types/raw/list/Members.d.ts +134 -0
  229. package/dist/types/raw/list/Members.js +4 -0
  230. package/dist/types/raw/list/Members.js.map +1 -0
  231. package/dist/types/raw/list/Tweets.d.ts +1968 -0
  232. package/dist/types/raw/list/Tweets.js +4 -0
  233. package/dist/types/raw/list/Tweets.js.map +1 -0
  234. package/dist/types/raw/media/FinalizeUpload.d.ts +18 -0
  235. package/dist/types/raw/media/FinalizeUpload.js +4 -0
  236. package/dist/types/raw/media/FinalizeUpload.js.map +1 -0
  237. package/dist/types/raw/media/InitalizeUpload.d.ts +10 -0
  238. package/dist/types/raw/media/InitalizeUpload.js +4 -0
  239. package/dist/types/raw/media/InitalizeUpload.js.map +1 -0
  240. package/dist/types/raw/media/LiveVideoStream.d.ts +19 -0
  241. package/dist/types/raw/media/LiveVideoStream.js +4 -0
  242. package/dist/types/raw/media/LiveVideoStream.js.map +1 -0
  243. package/dist/types/raw/space/Details.d.ts +315 -0
  244. package/dist/types/raw/space/Details.js +4 -0
  245. package/dist/types/raw/space/Details.js.map +1 -0
  246. package/dist/types/raw/tweet/Details.d.ts +183 -0
  247. package/dist/types/raw/tweet/Details.js +4 -0
  248. package/dist/types/raw/tweet/Details.js.map +1 -0
  249. package/dist/types/raw/tweet/Like.d.ts +12 -0
  250. package/dist/types/raw/tweet/Like.js +4 -0
  251. package/dist/types/raw/tweet/Like.js.map +1 -0
  252. package/dist/types/raw/tweet/Likers.d.ts +170 -0
  253. package/dist/types/raw/tweet/Likers.js +4 -0
  254. package/dist/types/raw/tweet/Likers.js.map +1 -0
  255. package/dist/types/raw/tweet/Post.d.ts +133 -0
  256. package/dist/types/raw/tweet/Post.js +4 -0
  257. package/dist/types/raw/tweet/Post.js.map +1 -0
  258. package/dist/types/raw/tweet/Replies.d.ts +465 -0
  259. package/dist/types/raw/tweet/Replies.js +4 -0
  260. package/dist/types/raw/tweet/Replies.js.map +1 -0
  261. package/dist/types/raw/tweet/Retweet.d.ts +25 -0
  262. package/dist/types/raw/tweet/Retweet.js +4 -0
  263. package/dist/types/raw/tweet/Retweet.js.map +1 -0
  264. package/dist/types/raw/tweet/Retweeters.d.ts +177 -0
  265. package/dist/types/raw/tweet/Retweeters.js +4 -0
  266. package/dist/types/raw/tweet/Retweeters.js.map +1 -0
  267. package/dist/types/raw/tweet/Schedule.d.ts +15 -0
  268. package/dist/types/raw/tweet/Schedule.js +4 -0
  269. package/dist/types/raw/tweet/Schedule.js.map +1 -0
  270. package/dist/types/raw/tweet/Search.d.ts +518 -0
  271. package/dist/types/raw/tweet/Search.js +4 -0
  272. package/dist/types/raw/tweet/Search.js.map +1 -0
  273. package/dist/types/raw/tweet/Unlike.d.ts +12 -0
  274. package/dist/types/raw/tweet/Unlike.js +4 -0
  275. package/dist/types/raw/tweet/Unlike.js.map +1 -0
  276. package/dist/types/raw/tweet/Unpost.d.ts +17 -0
  277. package/dist/types/raw/tweet/Unpost.js +4 -0
  278. package/dist/types/raw/tweet/Unpost.js.map +1 -0
  279. package/dist/types/raw/tweet/Unretweet.d.ts +25 -0
  280. package/dist/types/raw/tweet/Unretweet.js +4 -0
  281. package/dist/types/raw/tweet/Unretweet.js.map +1 -0
  282. package/dist/types/raw/tweet/Unschedule.d.ts +12 -0
  283. package/dist/types/raw/tweet/Unschedule.js +4 -0
  284. package/dist/types/raw/tweet/Unschedule.js.map +1 -0
  285. package/dist/types/raw/user/Affiliates.d.ts +154 -0
  286. package/dist/types/raw/user/Affiliates.js +4 -0
  287. package/dist/types/raw/user/Affiliates.js.map +1 -0
  288. package/dist/types/raw/user/Analytics.d.ts +32 -0
  289. package/dist/types/raw/user/Analytics.js +4 -0
  290. package/dist/types/raw/user/Analytics.js.map +1 -0
  291. package/dist/types/raw/user/Bookmarks.d.ts +550 -0
  292. package/dist/types/raw/user/Bookmarks.js +4 -0
  293. package/dist/types/raw/user/Bookmarks.js.map +1 -0
  294. package/dist/types/raw/user/Details.d.ts +157 -0
  295. package/dist/types/raw/user/Details.js +4 -0
  296. package/dist/types/raw/user/Details.js.map +1 -0
  297. package/dist/types/raw/user/Follow.d.ts +248 -0
  298. package/dist/types/raw/user/Follow.js +4 -0
  299. package/dist/types/raw/user/Follow.js.map +1 -0
  300. package/dist/types/raw/user/Followed.d.ts +1666 -0
  301. package/dist/types/raw/user/Followed.js +4 -0
  302. package/dist/types/raw/user/Followed.js.map +1 -0
  303. package/dist/types/raw/user/Followers.d.ts +182 -0
  304. package/dist/types/raw/user/Followers.js +4 -0
  305. package/dist/types/raw/user/Followers.js.map +1 -0
  306. package/dist/types/raw/user/Following.d.ts +182 -0
  307. package/dist/types/raw/user/Following.js +4 -0
  308. package/dist/types/raw/user/Following.js.map +1 -0
  309. package/dist/types/raw/user/Highlights.d.ts +1106 -0
  310. package/dist/types/raw/user/Highlights.js +4 -0
  311. package/dist/types/raw/user/Highlights.js.map +1 -0
  312. package/dist/types/raw/user/Likes.d.ts +1065 -0
  313. package/dist/types/raw/user/Likes.js +4 -0
  314. package/dist/types/raw/user/Likes.js.map +1 -0
  315. package/dist/types/raw/user/Media.d.ts +1492 -0
  316. package/dist/types/raw/user/Media.js +4 -0
  317. package/dist/types/raw/user/Media.js.map +1 -0
  318. package/dist/types/raw/user/Notifications.d.ts +142 -0
  319. package/dist/types/raw/user/Notifications.js +4 -0
  320. package/dist/types/raw/user/Notifications.js.map +1 -0
  321. package/dist/types/raw/user/Recommended.d.ts +1991 -0
  322. package/dist/types/raw/user/Recommended.js +4 -0
  323. package/dist/types/raw/user/Recommended.js.map +1 -0
  324. package/dist/types/raw/user/Scheduled.d.ts +31 -0
  325. package/dist/types/raw/user/Scheduled.js +4 -0
  326. package/dist/types/raw/user/Scheduled.js.map +1 -0
  327. package/dist/types/raw/user/Subscriptions.d.ts +151 -0
  328. package/dist/types/raw/user/Subscriptions.js +4 -0
  329. package/dist/types/raw/user/Subscriptions.js.map +1 -0
  330. package/dist/types/raw/user/Tweets.d.ts +1065 -0
  331. package/dist/types/raw/user/Tweets.js +4 -0
  332. package/dist/types/raw/user/Tweets.js.map +1 -0
  333. package/dist/types/raw/user/TweetsAndReplies.d.ts +1065 -0
  334. package/dist/types/raw/user/TweetsAndReplies.js +4 -0
  335. package/dist/types/raw/user/TweetsAndReplies.js.map +1 -0
  336. package/dist/types/raw/user/Unfollow.d.ts +248 -0
  337. package/dist/types/raw/user/Unfollow.js +4 -0
  338. package/dist/types/raw/user/Unfollow.js.map +1 -0
  339. package/eslint.config.mjs +17 -0
  340. package/package.json +22 -19
  341. package/src/Rettiwt.ts +22 -7
  342. package/src/cli.ts +0 -2
  343. package/src/collections/Extractors.ts +40 -34
  344. package/src/collections/Groups.ts +4 -0
  345. package/src/collections/Requests.ts +46 -44
  346. package/src/commands/Tweet.ts +35 -7
  347. package/src/commands/User.ts +13 -2
  348. package/src/enums/Authentication.ts +10 -0
  349. package/src/enums/Data.ts +3 -3
  350. package/src/enums/Media.ts +10 -0
  351. package/src/enums/Notification.ts +12 -0
  352. package/src/enums/Resource.ts +4 -0
  353. package/src/enums/raw/Analytics.ts +29 -0
  354. package/src/enums/raw/Media.ts +10 -0
  355. package/src/enums/raw/Notification.ts +11 -0
  356. package/src/enums/raw/Tweet.ts +9 -0
  357. package/src/helper/JsonUtils.ts +1 -1
  358. package/src/helper/TidUtils.ts +189 -0
  359. package/src/index.ts +78 -44
  360. package/src/models/RettiwtConfig.ts +64 -0
  361. package/src/models/args/FetchArgs.ts +86 -436
  362. package/src/models/args/PostArgs.ts +24 -249
  363. package/src/models/auth/AuthCookie.ts +58 -0
  364. package/src/models/auth/AuthCredential.ts +85 -0
  365. package/src/models/data/CursoredData.ts +21 -26
  366. package/src/models/data/List.ts +18 -15
  367. package/src/models/data/Notification.ts +25 -38
  368. package/src/models/data/Tweet.ts +143 -104
  369. package/src/models/data/User.ts +74 -44
  370. package/src/models/errors/RettiwtError.ts +3 -2
  371. package/src/models/params/Variables.ts +62 -0
  372. package/src/requests/List.ts +121 -0
  373. package/src/requests/Media.ts +67 -0
  374. package/src/requests/Tweet.ts +496 -0
  375. package/src/requests/User.ts +783 -0
  376. package/src/services/{public → internal}/AuthService.ts +28 -60
  377. package/src/services/internal/LogService.ts +4 -19
  378. package/src/services/internal/TidService.ts +147 -0
  379. package/src/services/public/FetcherService.ts +89 -59
  380. package/src/services/public/ListService.ts +4 -4
  381. package/src/services/public/TweetService.ts +129 -42
  382. package/src/services/public/UserService.ts +49 -37
  383. package/src/types/RettiwtConfig.ts +18 -12
  384. package/src/types/args/FetchArgs.ts +148 -0
  385. package/src/types/args/PostArgs.ts +112 -0
  386. package/src/types/auth/AuthCookie.ts +22 -0
  387. package/src/types/auth/AuthCredential.ts +28 -0
  388. package/src/types/auth/TidDynamicArgs.ts +10 -0
  389. package/src/types/auth/TidHeader.ts +12 -0
  390. package/src/types/auth/TidParams.ts +36 -0
  391. package/src/types/auth/TidProvider.ts +19 -0
  392. package/src/types/data/CursoredData.ts +18 -0
  393. package/src/types/data/List.ts +27 -0
  394. package/src/types/data/Notification.ts +26 -0
  395. package/src/types/data/Tweet.ts +96 -0
  396. package/src/types/data/User.ts +48 -0
  397. package/src/types/params/Variables.ts +41 -0
  398. package/src/types/raw/base/Analytic.ts +26 -0
  399. package/src/types/raw/base/Cursor.ts +13 -0
  400. package/src/types/raw/base/LimitedVisibilityTweet.ts +40 -0
  401. package/src/types/raw/base/List.ts +50 -0
  402. package/src/types/raw/base/Media.ts +53 -0
  403. package/src/types/raw/base/Notification.ts +67 -0
  404. package/src/types/raw/base/Space.ts +35 -0
  405. package/src/types/raw/base/Tweet.ts +139 -0
  406. package/src/types/raw/base/User.ts +164 -0
  407. package/src/types/raw/composite/DataResult.ts +8 -0
  408. package/src/types/raw/composite/TimelineTweet.ts +14 -0
  409. package/src/types/raw/composite/TimelineUser.ts +13 -0
  410. package/src/types/raw/generic/Error.ts +35 -0
  411. package/src/types/raw/generic/Response.ts +13 -0
  412. package/src/types/raw/list/Details.ts +137 -0
  413. package/src/types/raw/list/Members.ts +154 -0
  414. package/src/types/raw/list/Tweets.ts +2296 -0
  415. package/src/types/raw/media/FinalizeUpload.ts +20 -0
  416. package/src/types/raw/media/InitalizeUpload.ts +12 -0
  417. package/src/types/raw/media/LiveVideoStream.ts +21 -0
  418. package/src/types/raw/space/Details.ts +359 -0
  419. package/src/types/raw/tweet/Details.ts +210 -0
  420. package/src/types/raw/tweet/Like.ts +14 -0
  421. package/src/types/raw/tweet/Likers.ts +200 -0
  422. package/src/types/raw/tweet/Post.ts +150 -0
  423. package/src/types/raw/tweet/Replies.ts +539 -0
  424. package/src/types/raw/tweet/Retweet.ts +31 -0
  425. package/src/types/raw/tweet/Retweeters.ts +208 -0
  426. package/src/types/raw/tweet/Schedule.ts +18 -0
  427. package/src/types/raw/tweet/Search.ts +597 -0
  428. package/src/types/raw/tweet/Unlike.ts +14 -0
  429. package/src/types/raw/tweet/Unpost.ts +20 -0
  430. package/src/types/raw/tweet/Unretweet.ts +31 -0
  431. package/src/types/raw/tweet/Unschedule.ts +14 -0
  432. package/src/types/raw/user/Affiliates.ts +179 -0
  433. package/src/types/raw/user/Analytics.ts +39 -0
  434. package/src/types/raw/user/Bookmarks.ts +637 -0
  435. package/src/types/raw/user/Details.ts +185 -0
  436. package/src/types/raw/user/Follow.ts +280 -0
  437. package/src/types/raw/user/Followed.ts +1942 -0
  438. package/src/types/raw/user/Followers.ts +215 -0
  439. package/src/types/raw/user/Following.ts +215 -0
  440. package/src/types/raw/user/Highlights.ts +1287 -0
  441. package/src/types/raw/user/Likes.ts +1254 -0
  442. package/src/types/raw/user/Media.ts +1738 -0
  443. package/src/types/raw/user/Notifications.ts +175 -0
  444. package/src/types/raw/user/Recommended.ts +2319 -0
  445. package/src/types/raw/user/Scheduled.ts +37 -0
  446. package/src/types/raw/user/Subscriptions.ts +176 -0
  447. package/src/types/raw/user/Tweets.ts +1254 -0
  448. package/src/types/raw/user/TweetsAndReplies.ts +1254 -0
  449. package/src/types/raw/user/Unfollow.ts +280 -0
  450. package/tsconfig.json +7 -5
  451. package/.eslintignore +0 -3
  452. package/dist/commands/Auth.d.ts +0 -10
  453. package/dist/commands/Auth.js +0 -101
  454. package/dist/commands/Auth.js.map +0 -1
  455. package/dist/models/errors/DataValidationError.d.ts +0 -30
  456. package/dist/models/errors/DataValidationError.js +0 -34
  457. package/dist/models/errors/DataValidationError.js.map +0 -1
  458. package/dist/services/public/AuthService.d.ts +0 -91
  459. package/dist/services/public/AuthService.js +0 -205
  460. package/dist/services/public/AuthService.js.map +0 -1
  461. package/dist/types/ReturnTypes.d.ts +0 -21
  462. package/dist/types/ReturnTypes.js.map +0 -1
  463. package/src/commands/Auth.ts +0 -46
  464. package/src/models/errors/DataValidationError.ts +0 -44
  465. package/src/types/ReturnTypes.ts +0 -24
@@ -1,51 +1,8 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __asyncValues = (this && this.__asyncValues) || function (o) {
39
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
40
- var m = o[Symbol.asyncIterator], i;
41
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
42
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
43
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
44
- };
45
2
  Object.defineProperty(exports, "__esModule", { value: true });
46
- var commander_1 = require("commander");
47
- var rettiwt_core_1 = require("rettiwt-core");
48
- var CliUtils_1 = require("../helper/CliUtils");
3
+ const commander_1 = require("commander");
4
+ const CliUtils_1 = require("../helper/CliUtils");
5
+ const FetchArgs_1 = require("../models/args/FetchArgs");
49
6
  /**
50
7
  * Creates a new 'tweet' command which uses the given Rettiwt instance.
51
8
  *
@@ -53,57 +10,62 @@ var CliUtils_1 = require("../helper/CliUtils");
53
10
  * @returns The created 'tweet' command.
54
11
  */
55
12
  function createTweetCommand(rettiwt) {
56
- var _this = this;
57
13
  // Creating the 'tweet' command
58
- var tweet = (0, commander_1.createCommand)('tweet').description('Access resources releated to tweets');
14
+ const tweet = (0, commander_1.createCommand)('tweet').description('Access resources releated to tweets');
59
15
  // Details
60
16
  tweet
61
17
  .command('details')
62
- .description('Fetch the details of tweet with the given id')
63
- .argument('<id>', 'The id of the tweet whose details are to be fetched')
64
- .action(function (id) { return __awaiter(_this, void 0, void 0, function () {
65
- var details, error_1;
66
- return __generator(this, function (_a) {
67
- switch (_a.label) {
68
- case 0:
69
- _a.trys.push([0, 2, , 3]);
70
- return [4 /*yield*/, rettiwt.tweet.details(id)];
71
- case 1:
72
- details = _a.sent();
73
- (0, CliUtils_1.output)(details);
74
- return [3 /*break*/, 3];
75
- case 2:
76
- error_1 = _a.sent();
77
- (0, CliUtils_1.output)(error_1);
78
- return [3 /*break*/, 3];
79
- case 3: return [2 /*return*/];
18
+ .description('Fetch the details of tweet/tweets with the given id/ids')
19
+ .argument('<id>', 'The comma-separated list of IDs of tweets whose details are to be fetched')
20
+ .action(async (id) => {
21
+ try {
22
+ // Getting the different IDs
23
+ const ids = id.split(',');
24
+ // If single ID given
25
+ if (ids.length <= 1) {
26
+ const details = await rettiwt.tweet.details(ids[0]);
27
+ (0, CliUtils_1.output)(details);
80
28
  }
81
- });
82
- }); });
29
+ // If multiple IDs give
30
+ else {
31
+ const details = await rettiwt.tweet.details(ids);
32
+ (0, CliUtils_1.output)(details);
33
+ }
34
+ }
35
+ catch (error) {
36
+ (0, CliUtils_1.output)(error);
37
+ }
38
+ });
83
39
  // Like
84
40
  tweet
85
41
  .command('like')
86
42
  .description('Like a tweet')
87
43
  .argument('<id>', 'The tweet to like')
88
- .action(function (id) { return __awaiter(_this, void 0, void 0, function () {
89
- var result, error_2;
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
92
- case 0:
93
- _a.trys.push([0, 2, , 3]);
94
- return [4 /*yield*/, rettiwt.tweet.like(id)];
95
- case 1:
96
- result = _a.sent();
97
- (0, CliUtils_1.output)(result);
98
- return [3 /*break*/, 3];
99
- case 2:
100
- error_2 = _a.sent();
101
- (0, CliUtils_1.output)(error_2);
102
- return [3 /*break*/, 3];
103
- case 3: return [2 /*return*/];
104
- }
105
- });
106
- }); });
44
+ .action(async (id) => {
45
+ try {
46
+ const result = await rettiwt.tweet.like(id);
47
+ (0, CliUtils_1.output)(result);
48
+ }
49
+ catch (error) {
50
+ (0, CliUtils_1.output)(error);
51
+ }
52
+ });
53
+ // Likers
54
+ tweet
55
+ .command('likers')
56
+ .description('Fetch the list of users who liked the given tweet. Only works for your own tweets')
57
+ .argument('<id>', 'The id of the tweet')
58
+ .argument('[count]', 'The number of likers to fetch')
59
+ .argument('[cursor]', 'The cursor to the batch of likers to fetch')
60
+ .action(async (id, count, cursor) => {
61
+ try {
62
+ const tweets = await rettiwt.tweet.likers(id, count ? parseInt(count) : undefined, cursor);
63
+ (0, CliUtils_1.output)(tweets);
64
+ }
65
+ catch (error) {
66
+ (0, CliUtils_1.output)(error);
67
+ }
68
+ });
107
69
  // List
108
70
  tweet
109
71
  .command('list')
@@ -111,25 +73,15 @@ function createTweetCommand(rettiwt) {
111
73
  .argument('<id>', 'The id of the tweet list')
112
74
  .argument('[count]', 'The number of tweets to fetch')
113
75
  .argument('[cursor]', 'The cursor to the batch of tweets to fetch')
114
- .action(function (id, count, cursor) { return __awaiter(_this, void 0, void 0, function () {
115
- var tweets, error_3;
116
- return __generator(this, function (_a) {
117
- switch (_a.label) {
118
- case 0:
119
- _a.trys.push([0, 2, , 3]);
120
- return [4 /*yield*/, rettiwt.tweet.list(id, count ? parseInt(count) : undefined, cursor)];
121
- case 1:
122
- tweets = _a.sent();
123
- (0, CliUtils_1.output)(tweets);
124
- return [3 /*break*/, 3];
125
- case 2:
126
- error_3 = _a.sent();
127
- (0, CliUtils_1.output)(error_3);
128
- return [3 /*break*/, 3];
129
- case 3: return [2 /*return*/];
130
- }
131
- });
132
- }); });
76
+ .action(async (id, count, cursor) => {
77
+ try {
78
+ const tweets = await rettiwt.tweet.list(id, count ? parseInt(count) : undefined, cursor);
79
+ (0, CliUtils_1.output)(tweets);
80
+ }
81
+ catch (error) {
82
+ (0, CliUtils_1.output)(error);
83
+ }
84
+ });
133
85
  // Post
134
86
  tweet
135
87
  .command('post')
@@ -138,54 +90,34 @@ function createTweetCommand(rettiwt) {
138
90
  .option('-m, --media [string]', 'Comma-separated list of ids of the media item(s) to be posted')
139
91
  .option('-q, --quote [string]', 'The id of the tweet to quote in the tweet to be posted')
140
92
  .option('-r, --reply [string]', 'The id of the tweet to which the reply is to be made, if the tweet is to be a reply')
141
- .action(function (text, options) { return __awaiter(_this, void 0, void 0, function () {
142
- var result, error_4;
143
- return __generator(this, function (_a) {
144
- switch (_a.label) {
145
- case 0:
146
- _a.trys.push([0, 2, , 3]);
147
- return [4 /*yield*/, rettiwt.tweet.post({
148
- text: text,
149
- media: (options === null || options === void 0 ? void 0 : options.media) ? options === null || options === void 0 ? void 0 : options.media.split(',').map(function (item) { return ({ id: item }); }) : undefined,
150
- quote: options === null || options === void 0 ? void 0 : options.quote,
151
- replyTo: options === null || options === void 0 ? void 0 : options.reply,
152
- })];
153
- case 1:
154
- result = _a.sent();
155
- (0, CliUtils_1.output)(result);
156
- return [3 /*break*/, 3];
157
- case 2:
158
- error_4 = _a.sent();
159
- (0, CliUtils_1.output)(error_4);
160
- return [3 /*break*/, 3];
161
- case 3: return [2 /*return*/];
162
- }
163
- });
164
- }); });
93
+ .action(async (text, options) => {
94
+ try {
95
+ const result = await rettiwt.tweet.post({
96
+ text: text,
97
+ media: options?.media ? options?.media.split(',').map((item) => ({ id: item })) : undefined,
98
+ quote: options?.quote,
99
+ replyTo: options?.reply,
100
+ });
101
+ (0, CliUtils_1.output)(result);
102
+ }
103
+ catch (error) {
104
+ (0, CliUtils_1.output)(error);
105
+ }
106
+ });
165
107
  // Retweet
166
108
  tweet
167
109
  .command('retweet')
168
110
  .description('Retweet a tweet')
169
111
  .argument('<id>', 'The tweet to retweet')
170
- .action(function (id) { return __awaiter(_this, void 0, void 0, function () {
171
- var result, error_5;
172
- return __generator(this, function (_a) {
173
- switch (_a.label) {
174
- case 0:
175
- _a.trys.push([0, 2, , 3]);
176
- return [4 /*yield*/, rettiwt.tweet.retweet(id)];
177
- case 1:
178
- result = _a.sent();
179
- (0, CliUtils_1.output)(result);
180
- return [3 /*break*/, 3];
181
- case 2:
182
- error_5 = _a.sent();
183
- (0, CliUtils_1.output)(error_5);
184
- return [3 /*break*/, 3];
185
- case 3: return [2 /*return*/];
186
- }
187
- });
188
- }); });
112
+ .action(async (id) => {
113
+ try {
114
+ const result = await rettiwt.tweet.retweet(id);
115
+ (0, CliUtils_1.output)(result);
116
+ }
117
+ catch (error) {
118
+ (0, CliUtils_1.output)(error);
119
+ }
120
+ });
189
121
  // Retweeters
190
122
  tweet
191
123
  .command('retweeters')
@@ -193,25 +125,15 @@ function createTweetCommand(rettiwt) {
193
125
  .argument('<id>', 'The id of the tweet')
194
126
  .argument('[count]', 'The number of retweeters to fetch')
195
127
  .argument('[cursor]', 'The cursor to the batch of retweeters to fetch')
196
- .action(function (id, count, cursor) { return __awaiter(_this, void 0, void 0, function () {
197
- var tweets, error_6;
198
- return __generator(this, function (_a) {
199
- switch (_a.label) {
200
- case 0:
201
- _a.trys.push([0, 2, , 3]);
202
- return [4 /*yield*/, rettiwt.tweet.retweeters(id, count ? parseInt(count) : undefined, cursor)];
203
- case 1:
204
- tweets = _a.sent();
205
- (0, CliUtils_1.output)(tweets);
206
- return [3 /*break*/, 3];
207
- case 2:
208
- error_6 = _a.sent();
209
- (0, CliUtils_1.output)(error_6);
210
- return [3 /*break*/, 3];
211
- case 3: return [2 /*return*/];
212
- }
213
- });
214
- }); });
128
+ .action(async (id, count, cursor) => {
129
+ try {
130
+ const tweets = await rettiwt.tweet.retweeters(id, count ? parseInt(count) : undefined, cursor);
131
+ (0, CliUtils_1.output)(tweets);
132
+ }
133
+ catch (error) {
134
+ (0, CliUtils_1.output)(error);
135
+ }
136
+ });
215
137
  // Schedule
216
138
  tweet
217
139
  .command('schedule')
@@ -221,31 +143,21 @@ function createTweetCommand(rettiwt) {
221
143
  .option('-m, --media [string]', 'Comma-separated list of ids of the media item(s) to be posted')
222
144
  .option('-q, --quote [string]', 'The id of the tweet to quote in the tweet to be posted')
223
145
  .option('-r, --reply [string]', 'The id of the tweet to which the reply is to be made, if the tweet is to be a reply')
224
- .action(function (text, time, options) { return __awaiter(_this, void 0, void 0, function () {
225
- var result, error_7;
226
- return __generator(this, function (_a) {
227
- switch (_a.label) {
228
- case 0:
229
- _a.trys.push([0, 2, , 3]);
230
- return [4 /*yield*/, rettiwt.tweet.schedule({
231
- text: text,
232
- media: (options === null || options === void 0 ? void 0 : options.media) ? options === null || options === void 0 ? void 0 : options.media.split(',').map(function (item) { return ({ id: item }); }) : undefined,
233
- quote: options === null || options === void 0 ? void 0 : options.quote,
234
- replyTo: options === null || options === void 0 ? void 0 : options.reply,
235
- scheduleFor: new Date(time),
236
- })];
237
- case 1:
238
- result = _a.sent();
239
- (0, CliUtils_1.output)(result);
240
- return [3 /*break*/, 3];
241
- case 2:
242
- error_7 = _a.sent();
243
- (0, CliUtils_1.output)(error_7);
244
- return [3 /*break*/, 3];
245
- case 3: return [2 /*return*/];
246
- }
247
- });
248
- }); });
146
+ .action(async (text, time, options) => {
147
+ try {
148
+ const result = await rettiwt.tweet.schedule({
149
+ text: text,
150
+ media: options?.media ? options?.media.split(',').map((item) => ({ id: item })) : undefined,
151
+ quote: options?.quote,
152
+ replyTo: options?.reply,
153
+ scheduleFor: new Date(time),
154
+ });
155
+ (0, CliUtils_1.output)(result);
156
+ }
157
+ catch (error) {
158
+ (0, CliUtils_1.output)(error);
159
+ }
160
+ });
249
161
  // Search
250
162
  tweet
251
163
  .command('search')
@@ -272,182 +184,94 @@ function createTweetCommand(rettiwt) {
272
184
  .option('--top', 'Matches top tweets instead of latest')
273
185
  .option('--stream', 'Stream the filtered tweets in pseudo-realtime')
274
186
  .option('-i, --interval <number>', 'The polling interval (in ms) to use for streaming. Default is 60000')
275
- .action(function (count, cursor, options) { return __awaiter(_this, void 0, void 0, function () {
276
- var _a, _b, _c, tweet_1, e_1_1, tweets, error_8;
277
- var _d, e_1, _e, _f;
278
- return __generator(this, function (_g) {
279
- switch (_g.label) {
280
- case 0:
281
- _g.trys.push([0, 16, , 17]);
282
- if (!(options === null || options === void 0 ? void 0 : options.stream)) return [3 /*break*/, 13];
283
- _g.label = 1;
284
- case 1:
285
- _g.trys.push([1, 6, 7, 12]);
286
- _a = true, _b = __asyncValues(rettiwt.tweet.stream(new TweetSearchOptions(options).toTweetFilter(), options === null || options === void 0 ? void 0 : options.interval));
287
- _g.label = 2;
288
- case 2: return [4 /*yield*/, _b.next()];
289
- case 3:
290
- if (!(_c = _g.sent(), _d = _c.done, !_d)) return [3 /*break*/, 5];
291
- _f = _c.value;
292
- _a = false;
293
- tweet_1 = _f;
294
- (0, CliUtils_1.output)(tweet_1);
295
- _g.label = 4;
296
- case 4:
297
- _a = true;
298
- return [3 /*break*/, 2];
299
- case 5: return [3 /*break*/, 12];
300
- case 6:
301
- e_1_1 = _g.sent();
302
- e_1 = { error: e_1_1 };
303
- return [3 /*break*/, 12];
304
- case 7:
305
- _g.trys.push([7, , 10, 11]);
306
- if (!(!_a && !_d && (_e = _b.return))) return [3 /*break*/, 9];
307
- return [4 /*yield*/, _e.call(_b)];
308
- case 8:
309
- _g.sent();
310
- _g.label = 9;
311
- case 9: return [3 /*break*/, 11];
312
- case 10:
313
- if (e_1) throw e_1.error;
314
- return [7 /*endfinally*/];
315
- case 11: return [7 /*endfinally*/];
316
- case 12: return [3 /*break*/, 15];
317
- case 13: return [4 /*yield*/, rettiwt.tweet.search(new TweetSearchOptions(options).toTweetFilter(), count ? parseInt(count) : undefined, cursor)];
318
- case 14:
319
- tweets = _g.sent();
320
- (0, CliUtils_1.output)(tweets);
321
- _g.label = 15;
322
- case 15: return [3 /*break*/, 17];
323
- case 16:
324
- error_8 = _g.sent();
325
- (0, CliUtils_1.output)(error_8);
326
- return [3 /*break*/, 17];
327
- case 17: return [2 /*return*/];
187
+ .action(async (count, cursor, options) => {
188
+ try {
189
+ // If search results are to be streamed
190
+ if (options?.stream) {
191
+ for await (const tweet of rettiwt.tweet.stream(new TweetSearchOptions(options).toTweetFilter(), options?.interval)) {
192
+ (0, CliUtils_1.output)(tweet);
193
+ }
328
194
  }
329
- });
330
- }); });
195
+ // If a normal search is to be done
196
+ else {
197
+ const tweets = await rettiwt.tweet.search(new TweetSearchOptions(options).toTweetFilter(), count ? parseInt(count) : undefined, cursor);
198
+ (0, CliUtils_1.output)(tweets);
199
+ }
200
+ }
201
+ catch (error) {
202
+ (0, CliUtils_1.output)(error);
203
+ }
204
+ });
331
205
  // Unlike
332
206
  tweet
333
207
  .command('unlike')
334
208
  .description('Unlike a tweet')
335
209
  .argument('<id>', 'The id of the tweet')
336
- .action(function (id) { return __awaiter(_this, void 0, void 0, function () {
337
- var result, error_9;
338
- return __generator(this, function (_a) {
339
- switch (_a.label) {
340
- case 0:
341
- _a.trys.push([0, 2, , 3]);
342
- return [4 /*yield*/, rettiwt.tweet.unlike(id)];
343
- case 1:
344
- result = _a.sent();
345
- (0, CliUtils_1.output)(result);
346
- return [3 /*break*/, 3];
347
- case 2:
348
- error_9 = _a.sent();
349
- (0, CliUtils_1.output)(error_9);
350
- return [3 /*break*/, 3];
351
- case 3: return [2 /*return*/];
352
- }
353
- });
354
- }); });
210
+ .action(async (id) => {
211
+ try {
212
+ const result = await rettiwt.tweet.unlike(id);
213
+ (0, CliUtils_1.output)(result);
214
+ }
215
+ catch (error) {
216
+ (0, CliUtils_1.output)(error);
217
+ }
218
+ });
355
219
  // Unpost
356
220
  tweet
357
221
  .command('unpost')
358
222
  .description('Unpost a tweet')
359
223
  .argument('<id>', 'The id of the tweet')
360
- .action(function (id) { return __awaiter(_this, void 0, void 0, function () {
361
- var result, error_10;
362
- return __generator(this, function (_a) {
363
- switch (_a.label) {
364
- case 0:
365
- _a.trys.push([0, 2, , 3]);
366
- return [4 /*yield*/, rettiwt.tweet.unpost(id)];
367
- case 1:
368
- result = _a.sent();
369
- (0, CliUtils_1.output)(result);
370
- return [3 /*break*/, 3];
371
- case 2:
372
- error_10 = _a.sent();
373
- (0, CliUtils_1.output)(error_10);
374
- return [3 /*break*/, 3];
375
- case 3: return [2 /*return*/];
376
- }
377
- });
378
- }); });
224
+ .action(async (id) => {
225
+ try {
226
+ const result = await rettiwt.tweet.unpost(id);
227
+ (0, CliUtils_1.output)(result);
228
+ }
229
+ catch (error) {
230
+ (0, CliUtils_1.output)(error);
231
+ }
232
+ });
379
233
  // Unretweet
380
234
  tweet
381
235
  .command('unretweet')
382
236
  .description('Unretweet a tweet')
383
237
  .argument('<id>', 'The id of the tweet')
384
- .action(function (id) { return __awaiter(_this, void 0, void 0, function () {
385
- var result, error_11;
386
- return __generator(this, function (_a) {
387
- switch (_a.label) {
388
- case 0:
389
- _a.trys.push([0, 2, , 3]);
390
- return [4 /*yield*/, rettiwt.tweet.unretweet(id)];
391
- case 1:
392
- result = _a.sent();
393
- (0, CliUtils_1.output)(result);
394
- return [3 /*break*/, 3];
395
- case 2:
396
- error_11 = _a.sent();
397
- (0, CliUtils_1.output)(error_11);
398
- return [3 /*break*/, 3];
399
- case 3: return [2 /*return*/];
400
- }
401
- });
402
- }); });
238
+ .action(async (id) => {
239
+ try {
240
+ const result = await rettiwt.tweet.unretweet(id);
241
+ (0, CliUtils_1.output)(result);
242
+ }
243
+ catch (error) {
244
+ (0, CliUtils_1.output)(error);
245
+ }
246
+ });
403
247
  // Unschedule
404
248
  tweet
405
249
  .command('unschedule')
406
250
  .description('Unschedule a tweet')
407
251
  .argument('<id>', 'The id of the tweet')
408
- .action(function (id) { return __awaiter(_this, void 0, void 0, function () {
409
- var result, error_12;
410
- return __generator(this, function (_a) {
411
- switch (_a.label) {
412
- case 0:
413
- _a.trys.push([0, 2, , 3]);
414
- return [4 /*yield*/, rettiwt.tweet.unschedule(id)];
415
- case 1:
416
- result = _a.sent();
417
- (0, CliUtils_1.output)(result);
418
- return [3 /*break*/, 3];
419
- case 2:
420
- error_12 = _a.sent();
421
- (0, CliUtils_1.output)(error_12);
422
- return [3 /*break*/, 3];
423
- case 3: return [2 /*return*/];
424
- }
425
- });
426
- }); });
252
+ .action(async (id) => {
253
+ try {
254
+ const result = await rettiwt.tweet.unschedule(id);
255
+ (0, CliUtils_1.output)(result);
256
+ }
257
+ catch (error) {
258
+ (0, CliUtils_1.output)(error);
259
+ }
260
+ });
427
261
  // Upload
428
262
  tweet
429
263
  .command('upload')
430
264
  .description('Upload a media file and returns the alloted id (valid for 24 hrs)')
431
265
  .argument('<path>', 'The path to the media to upload')
432
- .action(function (path) { return __awaiter(_this, void 0, void 0, function () {
433
- var id, error_13;
434
- return __generator(this, function (_a) {
435
- switch (_a.label) {
436
- case 0:
437
- _a.trys.push([0, 2, , 3]);
438
- return [4 /*yield*/, rettiwt.tweet.upload(path)];
439
- case 1:
440
- id = _a.sent();
441
- (0, CliUtils_1.output)(id);
442
- return [3 /*break*/, 3];
443
- case 2:
444
- error_13 = _a.sent();
445
- (0, CliUtils_1.output)(error_13);
446
- return [3 /*break*/, 3];
447
- case 3: return [2 /*return*/];
448
- }
449
- });
450
- }); });
266
+ .action(async (path) => {
267
+ try {
268
+ const id = await rettiwt.tweet.upload(path);
269
+ (0, CliUtils_1.output)(id);
270
+ }
271
+ catch (error) {
272
+ (0, CliUtils_1.output)(error);
273
+ }
274
+ });
451
275
  return tweet;
452
276
  }
453
277
  /**
@@ -455,43 +279,61 @@ function createTweetCommand(rettiwt) {
455
279
  *
456
280
  * @remarks The search options are implementations of the ones offered by {@link TweetFilter}
457
281
  */
458
- var TweetSearchOptions = /** @class */ (function () {
282
+ class TweetSearchOptions {
283
+ end;
284
+ excludeLinks = false;
285
+ excludeReplies = false;
286
+ excludeWords;
287
+ from;
288
+ hashtags;
289
+ interval;
290
+ list;
291
+ mentions;
292
+ minLikes;
293
+ minReplies;
294
+ minRetweets;
295
+ optionalWords;
296
+ phrase;
297
+ quoted;
298
+ start;
299
+ stream;
300
+ to;
301
+ top;
302
+ words;
459
303
  /**
460
304
  * Initializes a new object from the given options.
461
305
  *
462
306
  * @param options - The search options.
463
307
  */
464
- function TweetSearchOptions(options) {
465
- this.excludeLinks = false;
466
- this.excludeReplies = false;
467
- this.from = options === null || options === void 0 ? void 0 : options.from;
468
- this.to = options === null || options === void 0 ? void 0 : options.to;
469
- this.words = options === null || options === void 0 ? void 0 : options.words;
470
- this.phrase = options === null || options === void 0 ? void 0 : options.phrase;
471
- this.optionalWords = options === null || options === void 0 ? void 0 : options.optionalWords;
472
- this.excludeWords = options === null || options === void 0 ? void 0 : options.excludeWords;
473
- this.hashtags = options === null || options === void 0 ? void 0 : options.hashtags;
474
- this.list = options === null || options === void 0 ? void 0 : options.list;
475
- this.mentions = options === null || options === void 0 ? void 0 : options.mentions;
476
- this.minReplies = options === null || options === void 0 ? void 0 : options.minReplies;
477
- this.minLikes = options === null || options === void 0 ? void 0 : options.minLikes;
478
- this.minRetweets = options === null || options === void 0 ? void 0 : options.minRetweets;
479
- this.quoted = options === null || options === void 0 ? void 0 : options.quoted;
480
- this.excludeLinks = options === null || options === void 0 ? void 0 : options.excludeLinks;
481
- this.excludeReplies = options === null || options === void 0 ? void 0 : options.excludeReplies;
482
- this.start = options === null || options === void 0 ? void 0 : options.start;
483
- this.end = options === null || options === void 0 ? void 0 : options.end;
484
- this.stream = options === null || options === void 0 ? void 0 : options.stream;
485
- this.interval = options === null || options === void 0 ? void 0 : options.interval;
486
- this.top = options === null || options === void 0 ? void 0 : options.top;
308
+ constructor(options) {
309
+ this.from = options?.from;
310
+ this.to = options?.to;
311
+ this.words = options?.words;
312
+ this.phrase = options?.phrase;
313
+ this.optionalWords = options?.optionalWords;
314
+ this.excludeWords = options?.excludeWords;
315
+ this.hashtags = options?.hashtags;
316
+ this.list = options?.list;
317
+ this.mentions = options?.mentions;
318
+ this.minReplies = options?.minReplies;
319
+ this.minLikes = options?.minLikes;
320
+ this.minRetweets = options?.minRetweets;
321
+ this.quoted = options?.quoted;
322
+ this.excludeLinks = options?.excludeLinks;
323
+ this.excludeReplies = options?.excludeReplies;
324
+ this.start = options?.start;
325
+ this.end = options?.end;
326
+ this.stream = options?.stream;
327
+ this.interval = options?.interval;
328
+ this.top = options?.top;
487
329
  }
488
330
  /**
489
331
  * Converts the filter options to a format recognizable by rettiwt-api.
490
332
  *
491
- * @returns The '{@link TweetFilter}' representation of filter options.
333
+ * @returns The '{@link ITweetFilter}' representation of filter options.
492
334
  */
493
- TweetSearchOptions.prototype.toTweetFilter = function () {
494
- return new rettiwt_core_1.TweetFilter({
335
+ toTweetFilter() {
336
+ return new FetchArgs_1.TweetFilter({
495
337
  fromUsers: this.from ? this.from.split(',') : undefined,
496
338
  toUsers: this.to ? this.to.split(',') : undefined,
497
339
  includeWords: this.words ? this.words.split(',') : undefined,
@@ -511,8 +353,7 @@ var TweetSearchOptions = /** @class */ (function () {
511
353
  top: this.top,
512
354
  endDate: this.end ? new Date(this.end) : undefined,
513
355
  });
514
- };
515
- return TweetSearchOptions;
516
- }());
356
+ }
357
+ }
517
358
  exports.default = createTweetCommand;
518
359
  //# sourceMappingURL=Tweet.js.map