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,8 +1,9 @@
1
1
  import { Command, createCommand } from 'commander';
2
- import { TweetFilter } from 'rettiwt-core';
3
2
 
4
3
  import { output } from '../helper/CliUtils';
4
+ import { TweetFilter } from '../models/args/FetchArgs';
5
5
  import { Rettiwt } from '../Rettiwt';
6
+ import { ITweetFilter } from '../types/args/FetchArgs';
6
7
 
7
8
  /**
8
9
  * Creates a new 'tweet' command which uses the given Rettiwt instance.
@@ -17,12 +18,23 @@ function createTweetCommand(rettiwt: Rettiwt): Command {
17
18
  // Details
18
19
  tweet
19
20
  .command('details')
20
- .description('Fetch the details of tweet with the given id')
21
- .argument('<id>', 'The id of the tweet whose details are to be fetched')
21
+ .description('Fetch the details of tweet/tweets with the given id/ids')
22
+ .argument('<id>', 'The comma-separated list of IDs of tweets whose details are to be fetched')
22
23
  .action(async (id: string) => {
23
24
  try {
24
- const details = await rettiwt.tweet.details(id);
25
- output(details);
25
+ // Getting the different IDs
26
+ const ids: string[] = id.split(',');
27
+
28
+ // If single ID given
29
+ if (ids.length <= 1) {
30
+ const details = await rettiwt.tweet.details(ids[0]);
31
+ output(details);
32
+ }
33
+ // If multiple IDs give
34
+ else {
35
+ const details = await rettiwt.tweet.details(ids);
36
+ output(details);
37
+ }
26
38
  } catch (error) {
27
39
  output(error);
28
40
  }
@@ -42,6 +54,22 @@ function createTweetCommand(rettiwt: Rettiwt): Command {
42
54
  }
43
55
  });
44
56
 
57
+ // Likers
58
+ tweet
59
+ .command('likers')
60
+ .description('Fetch the list of users who liked the given tweet. Only works for your own tweets')
61
+ .argument('<id>', 'The id of the tweet')
62
+ .argument('[count]', 'The number of likers to fetch')
63
+ .argument('[cursor]', 'The cursor to the batch of likers to fetch')
64
+ .action(async (id: string, count?: string, cursor?: string) => {
65
+ try {
66
+ const tweets = await rettiwt.tweet.likers(id, count ? parseInt(count) : undefined, cursor);
67
+ output(tweets);
68
+ } catch (error) {
69
+ output(error);
70
+ }
71
+ });
72
+
45
73
  // List
46
74
  tweet
47
75
  .command('list')
@@ -331,9 +359,9 @@ class TweetSearchOptions {
331
359
  /**
332
360
  * Converts the filter options to a format recognizable by rettiwt-api.
333
361
  *
334
- * @returns The '{@link TweetFilter}' representation of filter options.
362
+ * @returns The '{@link ITweetFilter}' representation of filter options.
335
363
  */
336
- public toTweetFilter(): TweetFilter {
364
+ public toTweetFilter(): ITweetFilter {
337
365
  return new TweetFilter({
338
366
  fromUsers: this.from ? this.from.split(',') : undefined,
339
367
  toUsers: this.to ? this.to.split(',') : undefined,
@@ -32,8 +32,19 @@ function createUserCommand(rettiwt: Rettiwt): Command {
32
32
  .argument('<id>', 'The username/id of the user whose details are to be fetched')
33
33
  .action(async (id: string) => {
34
34
  try {
35
- const details = await rettiwt.user.details(id);
36
- output(details);
35
+ // Getting the different IDs
36
+ const ids: string[] = id.split(',');
37
+
38
+ // If single ID given
39
+ if (ids.length <= 1) {
40
+ const details = await rettiwt.user.details(ids[0]);
41
+ output(details);
42
+ }
43
+ // If multiple IDs given
44
+ else {
45
+ const details = await rettiwt.user.details(ids);
46
+ output(details);
47
+ }
37
48
  } catch (error) {
38
49
  output(error);
39
50
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The different types of authentication for authenticating against Twitter.
3
+ *
4
+ * @public
5
+ */
6
+ export enum EAuthenticationType {
7
+ GUEST = 'GUEST',
8
+ USER = 'USER',
9
+ LOGIN = 'LOGIN',
10
+ }
package/src/enums/Data.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * @internal
5
5
  */
6
6
  export enum EBaseType {
7
- NOTIFICATION = 'Notification',
8
- TWEET = 'Tweet',
9
- USER = 'User',
7
+ NOTIFICATION = 'NOTIFICATION',
8
+ TWEET = 'TWEET',
9
+ USER = 'USER',
10
10
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The different types of media items.
3
+ *
4
+ * @public
5
+ */
6
+ export enum EMediaType {
7
+ PHOTO = 'PHOTO',
8
+ VIDEO = 'VIDEO',
9
+ GIF = 'GIF',
10
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The different types of notifications.
3
+ *
4
+ * @public
5
+ */
6
+ export enum ENotificationType {
7
+ RECOMMENDATION = 'RECOMMENDATION',
8
+ INFORMATION = 'INFORMATION',
9
+ LIVE = 'LIVE',
10
+ ALERT = 'ALERT',
11
+ UNDEFINED = 'UNDEFINED',
12
+ }
@@ -16,8 +16,11 @@ export enum EResourceType {
16
16
  // TWEET
17
17
  TWEET_DETAILS = 'TWEET_DETAILS',
18
18
  TWEET_DETAILS_ALT = 'TWEET_DETAILS_ALT',
19
+ TWEET_DETAILS_BULK = 'TWEET_DETAILS_BULK',
19
20
  TWEET_LIKE = 'TWEET_LIKE',
21
+ TWEET_LIKERS = 'TWEET_LIKERS',
20
22
  TWEET_POST = 'TWEET_POST',
23
+ TWEET_REPLIES = 'TWEET_REPLIES',
21
24
  TWEET_RETWEET = 'TWEET_RETWEET',
22
25
  TWEET_RETWEETERS = 'TWEET_RETWEETERS',
23
26
  TWEET_SCHEDULE = 'TWEET_SCHEDULE',
@@ -31,6 +34,7 @@ export enum EResourceType {
31
34
  USER_BOOKMARKS = 'USER_BOOKMARKS',
32
35
  USER_DETAILS_BY_USERNAME = 'USER_DETAILS_BY_USERNAME',
33
36
  USER_DETAILS_BY_ID = 'USER_DETAILS_BY_ID',
37
+ USER_DETAILS_BY_IDS_BULK = 'USER_DETAILS_BY_IDS_BULK',
34
38
  USER_FEED_FOLLOWED = 'USER_FEED_FOLLOWED',
35
39
  USER_FEED_RECOMMENDED = 'USER_FEED_RECOMMENDED',
36
40
  USER_FOLLOW = 'USER_FOLLOW',
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Granularity types for analytics.
3
+ *
4
+ * @public
5
+ */
6
+ export enum ERawAnalyticsGranularity {
7
+ DAILY = 'Daily',
8
+ WEEKLY = 'Weekly',
9
+ MONTHLY = 'Monthly',
10
+ }
11
+
12
+ /**
13
+ * The different types of metric someone can request.
14
+ *
15
+ * @public
16
+ */
17
+ export enum ERawAnalyticsMetric {
18
+ ENGAGEMENTS = 'Engagements',
19
+ IMPRESSIONS = 'Impressions',
20
+ PROFILE_VISITS = 'ProfileVisits',
21
+ FOLLOWS = 'Follows',
22
+ VIDEO_VIEWS = 'VideoViews',
23
+ REPLIES = 'Replies',
24
+ LIKES = 'Likes',
25
+ RETWEETS = 'Retweets',
26
+ MEDIA_VIEWS = 'MediaViews',
27
+ BOOKMARK = 'Bookmark',
28
+ SHARE = 'Share',
29
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The different types of media items.
3
+ *
4
+ * @public
5
+ */
6
+ export enum ERawMediaType {
7
+ PHOTO = 'photo',
8
+ VIDEO = 'video',
9
+ GIF = 'animated_gif',
10
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The different types of notifications.
3
+ *
4
+ * @public
5
+ */
6
+ export enum ERawNotificationType {
7
+ RECOMMENDATION = 'recommendation_icon',
8
+ INFORMATION = 'bird_icon',
9
+ LIVE = 'live_icon',
10
+ ALERT = 'bell_icon',
11
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The different types of search results when searching for Tweets.
3
+ *
4
+ * @public
5
+ */
6
+ export enum ERawTweetSearchResultType {
7
+ LATEST = 'Latest',
8
+ TOP = 'Top',
9
+ }
@@ -24,7 +24,7 @@ export function findByFilter<T>(data: NonNullable<unknown>, key: string, value:
24
24
  * Therefore, map(item =\> findByFilter(.......)) returns an array of arrays.
25
25
  * Therefore, using ... operator to spread the 2-D array in 1-D array.
26
26
  */
27
- res = res.concat(...data.map((item) => findByFilter<T>(item as NonNullable<unknown>, key, value)));
27
+ res = res.concat(...data.map((item: NonNullable<unknown>) => findByFilter<T>(item, key, value)));
28
28
  }
29
29
  // If the data is an object
30
30
  else if (data != null && typeof data == 'object') {
@@ -0,0 +1,189 @@
1
+ import { createHash } from 'node:crypto';
2
+
3
+ import { ITidParams } from '../types/auth/TidParams';
4
+
5
+ export function calculateClientTransactionIdHeader(args: ITidParams): string {
6
+ const time = Math.floor(((args.time || Date.now()) - 1682924400 * 1000) / 1000);
7
+ const timeBuffer = new Uint8Array(new Uint32Array([time]).buffer);
8
+
9
+ const keyBytes = Array.from(Buffer.from(args.verificationKey, 'base64'));
10
+ const animationKey = args.animationKey || getAnimationKey(keyBytes, args.frames, args.indices);
11
+
12
+ const value = [args.method, args.path, time].join('!') + args.keyword + animationKey;
13
+ const valueEncoded = new TextEncoder().encode(value);
14
+
15
+ const hash = createHash('sha-256').update(valueEncoded).digest();
16
+ const hashBytes = Array.from(new Uint8Array(hash));
17
+
18
+ const xorByte = args.xorByte || Math.floor(Math.random() * 256);
19
+
20
+ const bytes = new Uint8Array(keyBytes.concat(Array.from(timeBuffer), hashBytes.slice(0, 16), [args.extraByte]));
21
+ return encode(xor(xorByte, bytes));
22
+ }
23
+
24
+ function getAnimationKey(keyBytes: number[], frames: number[][][], indices: number[]): string {
25
+ const totalTime = 4096;
26
+ const rowIndex = keyBytes[indices[0]] % 16;
27
+ const frameTime = indices
28
+ .slice(1)
29
+ .map((idx) => keyBytes[idx] % 16)
30
+ .reduce((a, b) => a * b, 1);
31
+ const targetTime = frameTime / totalTime;
32
+ const frameRow = frames[keyBytes[5] % 4][rowIndex];
33
+ return animate(frameRow, targetTime);
34
+ }
35
+
36
+ function animate(frameRow: number[], targetTime: number): string {
37
+ const curves = frameRow.slice(7).map((v, i) => Number(a(v, b(i), 1).toFixed(2)));
38
+ const cubicValue = getCubicCurveValue(curves, targetTime);
39
+
40
+ const fromColor = [...frameRow.slice(0, 3), 1];
41
+ const toColor = [...frameRow.slice(3, 6), 1];
42
+ const color = interpolate(fromColor, toColor, cubicValue);
43
+
44
+ const fromRotation = [0];
45
+ const toRotation = [Math.floor(a(frameRow[6], 60, 360))];
46
+ const rotation = interpolate(fromRotation, toRotation, cubicValue);
47
+ const matrix = convertRotationToMatrix(rotation[0]);
48
+
49
+ const strArray: string[] = [];
50
+ for (let i = 0; i < color.length - 1; i++) {
51
+ strArray.push(Math.round(color[i]).toString(16));
52
+ }
53
+
54
+ for (let i = 0; i < matrix.length; i++) {
55
+ let rounded = Number(matrix[i].toFixed(2));
56
+ if (rounded < 0) {
57
+ rounded = -rounded;
58
+ }
59
+ const hexValue = floatToHex(rounded);
60
+ if (hexValue.startsWith('.')) {
61
+ strArray.push('0' + hexValue);
62
+ } else if (hexValue) {
63
+ strArray.push(hexValue);
64
+ } else {
65
+ strArray.push('0');
66
+ }
67
+ }
68
+
69
+ strArray.push('0', '0');
70
+ return strArray.join('').replace(/[.-]/g, '').toLowerCase();
71
+ }
72
+
73
+ function a(b: number, c: number, d: number): number {
74
+ return (b * (d - c)) / 255 + c;
75
+ }
76
+
77
+ function b(a: number): number {
78
+ return a % 2 === 1 ? -1 : 0;
79
+ }
80
+
81
+ function getCubicCurveValue(curves: number[], time: number): number {
82
+ let startGradient = 0;
83
+ let endGradient = 0;
84
+
85
+ if (time <= 0) {
86
+ if (curves[0] > 0) {
87
+ startGradient = curves[1] / curves[0];
88
+ } else if (curves[1] === 0 && curves[2] > 0) {
89
+ startGradient = curves[3] / curves[2];
90
+ }
91
+ return startGradient * time;
92
+ }
93
+
94
+ if (time >= 1) {
95
+ if (curves[2] < 1) {
96
+ endGradient = (curves[3] - 1) / (curves[2] - 1);
97
+ } else if (curves[2] === 1 && curves[0] < 1) {
98
+ endGradient = (curves[1] - 1) / (curves[0] - 1);
99
+ }
100
+ return 1 + endGradient * (time - 1);
101
+ }
102
+
103
+ let start = 0;
104
+ let end = 1;
105
+ let mid = 0;
106
+
107
+ while (start < end) {
108
+ mid = (start + end) / 2;
109
+ const xEst = calculateBezier(curves[0], curves[2], mid);
110
+ if (Math.abs(time - xEst) < 0.00001) {
111
+ return calculateBezier(curves[1], curves[3], mid);
112
+ }
113
+ if (xEst < time) {
114
+ start = mid;
115
+ } else {
116
+ end = mid;
117
+ }
118
+ }
119
+
120
+ return calculateBezier(curves[1], curves[3], mid);
121
+ }
122
+
123
+ function calculateBezier(a: number, b: number, m: number): number {
124
+ return 3 * a * (1 - m) * (1 - m) * m + 3 * b * (1 - m) * m * m + m * m * m;
125
+ }
126
+
127
+ function interpolate(from: number[], to: number[], f: number): number[] {
128
+ const out: number[] = [];
129
+ for (let i = 0; i < from.length; i++) {
130
+ out.push(from[i] * (1 - f) + to[i] * f);
131
+ }
132
+ return out;
133
+ }
134
+
135
+ function convertRotationToMatrix(degrees: number): number[] {
136
+ const radians = (degrees * Math.PI) / 180;
137
+ const c = Math.cos(radians);
138
+ const s = Math.sin(radians);
139
+ return [c, -s, s, c];
140
+ }
141
+
142
+ function floatToHex(x: number): string {
143
+ const result: string[] = [];
144
+ let quotient = Math.floor(x);
145
+ let fraction = x - quotient;
146
+
147
+ while (quotient > 0) {
148
+ const remainder = quotient % 16;
149
+ quotient = Math.floor(quotient / 16);
150
+
151
+ if (remainder > 9) {
152
+ result.unshift(String.fromCharCode(remainder + 55));
153
+ } else {
154
+ result.unshift(remainder.toString());
155
+ }
156
+ }
157
+
158
+ if (fraction === 0) {
159
+ return result.join('');
160
+ }
161
+
162
+ result.push('.');
163
+
164
+ while (fraction > 0) {
165
+ fraction *= 16;
166
+ const integer = Math.floor(fraction);
167
+ fraction -= integer;
168
+
169
+ if (integer > 9) {
170
+ result.push(String.fromCharCode(integer + 55));
171
+ } else {
172
+ result.push(integer.toString());
173
+ }
174
+ }
175
+
176
+ return result.join('');
177
+ }
178
+
179
+ function xor(xorByte: number, data: Uint8Array): Uint8Array {
180
+ return new Uint8Array([xorByte, ...data.map((v) => v ^ xorByte)]);
181
+ }
182
+
183
+ function encode(data: Uint8Array): string {
184
+ return btoa(
185
+ Array.from(data)
186
+ .map((v) => String.fromCharCode(v))
187
+ .join(''),
188
+ ).replaceAll('=', '');
189
+ }
package/src/index.ts CHANGED
@@ -2,70 +2,104 @@
2
2
  export * from './Rettiwt';
3
3
 
4
4
  // ENUMS
5
+ export * from './enums/raw/Analytics';
6
+ export * from './enums/raw/Media';
7
+ export * from './enums/raw/Notification';
8
+ export * from './enums/raw/Tweet';
5
9
  export * from './enums/Api';
10
+ export * from './enums/Authentication';
11
+ export * from './enums/Data';
6
12
  export * from './enums/Http';
13
+ export * from './enums/Logging';
14
+ export * from './enums/Media';
15
+ export * from './enums/Notification';
7
16
  export * from './enums/Resource';
8
17
 
9
- // ARG MODELS
18
+ // MODELS
10
19
  export * from './models/args/FetchArgs';
11
20
  export * from './models/args/PostArgs';
12
-
13
- // DATA MODELS
14
21
  export * from './models/data/CursoredData';
15
22
  export * from './models/data/List';
16
23
  export * from './models/data/Notification';
17
24
  export * from './models/data/Tweet';
18
25
  export * from './models/data/User';
19
-
20
- // ERROR MODELS
21
26
  export * from './models/errors/ApiError';
22
- export * from './models/errors/DataValidationError';
23
27
  export * from './models/errors/HttpError';
24
28
  export * from './models/errors/RettiwtError';
25
29
  export * from './models/errors/TimeoutError';
26
30
 
31
+ // REQUESTS
32
+ export * from './requests/List';
33
+ export * from './requests/Media';
34
+ export * from './requests/Tweet';
35
+ export * from './requests/User';
36
+
27
37
  // SERVICES
28
- export * from './services/public/AuthService';
29
38
  export * from './services/public/FetcherService';
39
+ export * from './services/public/ListService';
30
40
  export * from './services/public/TweetService';
31
41
  export * from './services/public/UserService';
32
42
 
33
43
  // TYPES
34
- export * from './types/RettiwtConfig';
44
+ export * from './types/args/FetchArgs';
45
+ export * from './types/args/PostArgs';
46
+ export * from './types/auth/TidProvider';
47
+ export * from './types/data/CursoredData';
48
+ export * from './types/data/List';
49
+ export * from './types/data/Notification';
50
+ export * from './types/data/Tweet';
51
+ export * from './types/data/User';
52
+ export * from './types/params/Variables';
53
+ export { IAnalytics as IRawAnalytics } from './types/raw/base/Analytic';
54
+ export { ICursor as IRawCursor } from './types/raw/base/Cursor';
55
+ export { ILimitedVisibilityTweet as IRawLimitedVisibilityTweet } from './types/raw/base/LimitedVisibilityTweet';
56
+ export { IList as IRawList } from './types/raw/base/List';
57
+ export { IMedia as IRawMedia } from './types/raw/base/Media';
58
+ export { INotification as IRawNotification } from './types/raw/base/Notification';
59
+ export { ISpace as IRawSpace } from './types/raw/base/Space';
60
+ export { ITweet as IRawTweet } from './types/raw/base/Tweet';
61
+ export { IUser as IRawUser } from './types/raw/base/User';
62
+ export { IDataResult as IRawDataResult } from './types/raw/composite/DataResult';
63
+ export { ITimelineTweet as IRawTimelineTweet } from './types/raw/composite/TimelineTweet';
64
+ export { ITimelineUser as IRawTimelineUser } from './types/raw/composite/TimelineUser';
65
+ export { IError as IRawError } from './types/raw/generic/Error';
66
+ export { IResponse as IRawResponse } from './types/raw/generic/Response';
67
+ export { IListDetailsResponse as IRawListDetailsResponse } from './types/raw/list/Details';
68
+ export { IListMembersResponse as IRawListMembersResponse } from './types/raw/list/Members';
69
+ export { IListTweetsResponse as IRawListTweetsResponse } from './types/raw/list/Tweets';
70
+ export { IMediaFinalizeUploadResponse as IRawMediaFinalizeUploadResponse } from './types/raw/media/FinalizeUpload';
71
+ export { IMediaInitializeUploadResponse as IRawMediaInitializeUploadResponse } from './types/raw/media/InitalizeUpload';
72
+ export { IMediaLiveVideoStreamResponse as IRawMediaLiveVideoStreamResponse } from './types/raw/media/LiveVideoStream';
73
+ export { ITweetDetailsResponse as IRawTweetDetailsResponse } from './types/raw/tweet/Details';
74
+ export { ITweetLikeResponse as IRawTweetLikeResponse } from './types/raw/tweet/Like';
75
+ export { ITweetLikersResponse as IRawTweetLikersResponse } from './types/raw/tweet/Likers';
76
+ export { ITweetPostResponse as IRawTweetPostResponse } from './types/raw/tweet/Post';
77
+ export { ITweetRepliesResponse as IRawTweetRepliesResponse } from './types/raw/tweet/Replies';
78
+ export { ITweetRetweetResponse as IRawTweetRetweetResponse } from './types/raw/tweet/Retweet';
79
+ export { ITweetRetweetersResponse as IRawTweetRetweetersResponse } from './types/raw/tweet/Retweeters';
80
+ export { ITweetScheduleResponse as IRawTweetScheduleResponse } from './types/raw/tweet/Schedule';
81
+ export { ITweetSearchResponse as IRawTweetSearchResponse } from './types/raw/tweet/Search';
82
+ export { ITweetUnlikeResponse as IRawTweetUnlikeResponse } from './types/raw/tweet/Unlike';
83
+ export { ITweetUnpostResponse as IRawTweetUnpostResponse } from './types/raw/tweet/Unpost';
84
+ export { ITweetUnretweetResponse as IRawTweetUnretweetResponse } from './types/raw/tweet/Unretweet';
85
+ export { ITweetUnscheduleResponse as ITRawTweetUnscheduleResponse } from './types/raw/tweet/Unschedule';
86
+ export { IUserAffiliatesResponse as IRawUserAffiliatesResponse } from './types/raw/user/Affiliates';
87
+ export { IUserAnalyticsResponse as IRawUserAnalyticsResponse } from './types/raw/user/Analytics';
88
+ export { IUserBookmarksResponse as IRawUserBookmarksResponse } from './types/raw/user/Bookmarks';
89
+ export { IUserDetailsResponse as IRawUserDetailsResponse } from './types/raw/user/Details';
90
+ export { IUserFollowResponse as IRawUserFollowResponse } from './types/raw/user/Follow';
91
+ export { IUserFollowedResponse as IRawUserFollowedResponse } from './types/raw/user/Followed';
92
+ export { IUserFollowersResponse as IRawUserFollowersResponse } from './types/raw/user/Followers';
93
+ export { IUserFollowingResponse as IRawUserFollowingResponse } from './types/raw/user/Following';
94
+ export { IUserHighlightsResponse as IRawUserHighlightsResponse } from './types/raw/user/Highlights';
95
+ export { IUserLikesResponse as IRawUserLikesResponse } from './types/raw/user/Likes';
96
+ export { IUserMediaResponse as IRawUserMediaResponse } from './types/raw/user/Media';
97
+ export { IUserNotificationsResponse as IRawUserNotificationsResponse } from './types/raw/user/Notifications';
98
+ export { IUserRecommendedResponse as IRawUserRecommendedResponse } from './types/raw/user/Recommended';
99
+ export { IUserScheduledResponse as IRawUserScheduledResponse } from './types/raw/user/Scheduled';
100
+ export { IUserSubscriptionsResponse as IRawUserSubscriptionsResponse } from './types/raw/user/Subscriptions';
101
+ export { IUserTweetsResponse as IRawUserTweetsResponse } from './types/raw/user/Tweets';
102
+ export { IUserTweetsAndRepliesResponse as IRawUserTweetsAndRepliesResponse } from './types/raw/user/TweetsAndReplies';
103
+ export { IUserUnfollowResponse as IRawUserUnfollowResponse } from './types/raw/user/Unfollow';
35
104
  export * from './types/ErrorHandler';
36
-
37
- // RAW TYPES
38
- export {
39
- IInitializeMediaUploadResponse,
40
- IListMembersResponse,
41
- IListTweetsResponse,
42
- ITweetDetailsResponse,
43
- ITweetLikeResponse,
44
- ITweetPostResponse,
45
- ITweetRepliesResponse,
46
- ITweetRetweetersResponse,
47
- ITweetRetweetResponse,
48
- ITweetScheduleResponse,
49
- ITweetSearchResponse,
50
- ITweetUnlikeResponse,
51
- ITweetUnpostResponse,
52
- ITweetUnscheduleResponse,
53
- ITweetUnretweetResponse,
54
- } from 'rettiwt-core';
55
- export {
56
- IUserBookmarksResponse,
57
- IUserDetailsResponse,
58
- IUserFollowedResponse,
59
- IUserFollowersResponse,
60
- IUserFollowingResponse,
61
- IUserFollowResponse,
62
- IUserHighlightsResponse,
63
- IUserLikesResponse,
64
- IUserMediaResponse,
65
- IUserNotificationsResponse,
66
- IUserRecommendedResponse,
67
- IUserSubscriptionsResponse,
68
- IUserTweetsAndRepliesResponse,
69
- IUserTweetsResponse,
70
- IUserUnfollowResponse,
71
- } from 'rettiwt-core';
105
+ export * from './types/RettiwtConfig';
@@ -0,0 +1,64 @@
1
+ import { Agent } from 'https';
2
+
3
+ import { HttpsProxyAgent } from 'https-proxy-agent';
4
+
5
+ import { AuthService } from '../services/internal/AuthService';
6
+ import { ITidProvider } from '../types/auth/TidProvider';
7
+ import { IErrorHandler } from '../types/ErrorHandler';
8
+ import { IRettiwtConfig } from '../types/RettiwtConfig';
9
+
10
+ export class RettiwtConfig implements IRettiwtConfig {
11
+ // Parameters for internal use
12
+ private _apiKey?: string;
13
+ private _httpsAgent: Agent;
14
+ private _userId: string | undefined;
15
+
16
+ // Parameters that can be set once, upon initialization
17
+ public readonly delay?: number | (() => number | Promise<number>);
18
+ public readonly errorHandler?: IErrorHandler;
19
+ public readonly logging?: boolean;
20
+ public readonly tidProvider?: ITidProvider;
21
+ public readonly timeout?: number;
22
+
23
+ // Parameters that can be changed on the fly
24
+ public headers?: { [key: string]: string };
25
+
26
+ /**
27
+ * @param config - The config for Rettiwt of type {@link IRettiwtConfig}.
28
+ */
29
+ public constructor(config?: IRettiwtConfig) {
30
+ this._apiKey = config?.apiKey;
31
+ this._httpsAgent = config?.proxyUrl ? new HttpsProxyAgent(config?.proxyUrl) : new Agent();
32
+ this._userId = config?.apiKey ? AuthService.getUserId(config?.apiKey) : undefined;
33
+ this.delay = config?.delay;
34
+ this.errorHandler = config?.errorHandler;
35
+ this.logging = config?.logging;
36
+ this.tidProvider = config?.tidProvider;
37
+ this.timeout = config?.timeout;
38
+ this.apiKey = config?.apiKey;
39
+ this.headers = config?.headers;
40
+ }
41
+
42
+ public get apiKey(): string | undefined {
43
+ return this._apiKey;
44
+ }
45
+
46
+ /** The HTTPS agent instance to use. */
47
+ public get httpsAgent(): Agent {
48
+ return this._httpsAgent;
49
+ }
50
+
51
+ /** The ID of the user associated with the API key, if any. */
52
+ public get userId(): string | undefined {
53
+ return this._userId;
54
+ }
55
+
56
+ public set apiKey(apiKey: string | undefined) {
57
+ this._apiKey = apiKey;
58
+ this._userId = apiKey ? AuthService.getUserId(apiKey) : undefined;
59
+ }
60
+
61
+ public set proxyUrl(proxyUrl: URL | undefined) {
62
+ this._httpsAgent = proxyUrl ? new HttpsProxyAgent(proxyUrl) : new Agent();
63
+ }
64
+ }