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.
- package/.eslintrc.js +2 -3
- package/.github/workflows/documentation.yml +1 -1
- package/.github/workflows/publish-alpha.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/.prettierignore +1 -1
- package/.tool-versions +1 -1
- package/README.md +100 -100
- package/dist/Rettiwt.d.ts +10 -3
- package/dist/Rettiwt.js +31 -12
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +8 -11
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +36 -2
- package/dist/collections/Extractors.js +41 -69
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.js +5 -1
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.d.ts +3 -3
- package/dist/collections/Requests.js +41 -40
- package/dist/collections/Requests.js.map +1 -1
- package/dist/commands/List.js +21 -78
- package/dist/commands/List.js.map +1 -1
- package/dist/commands/Tweet.js +214 -373
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +138 -305
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Authentication.d.ts +10 -0
- package/dist/enums/Authentication.js +15 -0
- package/dist/enums/Authentication.js.map +1 -0
- package/dist/enums/Data.d.ts +3 -3
- package/dist/enums/Data.js +3 -3
- package/dist/enums/Media.d.ts +10 -0
- package/dist/enums/Media.js +15 -0
- package/dist/enums/Media.js.map +1 -0
- package/dist/enums/Notification.d.ts +12 -0
- package/dist/enums/Notification.js +17 -0
- package/dist/enums/Notification.js.map +1 -0
- package/dist/enums/Resource.d.ts +4 -0
- package/dist/enums/Resource.js +4 -0
- package/dist/enums/Resource.js.map +1 -1
- package/dist/enums/raw/Analytics.d.ts +28 -0
- package/dist/enums/raw/Analytics.js +34 -0
- package/dist/enums/raw/Analytics.js.map +1 -0
- package/dist/enums/raw/Media.d.ts +10 -0
- package/dist/enums/raw/Media.js +15 -0
- package/dist/enums/raw/Media.js.map +1 -0
- package/dist/enums/raw/Notification.d.ts +11 -0
- package/dist/enums/raw/Notification.js +16 -0
- package/dist/enums/raw/Notification.js.map +1 -0
- package/dist/enums/raw/Tweet.d.ts +9 -0
- package/dist/enums/raw/Tweet.js +14 -0
- package/dist/enums/raw/Tweet.js.map +1 -0
- package/dist/helper/CliUtils.js +1 -2
- package/dist/helper/CliUtils.js.map +1 -1
- package/dist/helper/JsonUtils.js +6 -11
- package/dist/helper/JsonUtils.js.map +1 -1
- package/dist/helper/TidUtils.d.ts +2 -0
- package/dist/helper/TidUtils.js +162 -0
- package/dist/helper/TidUtils.js.map +1 -0
- package/dist/index.d.ts +75 -5
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/models/RettiwtConfig.d.ts +28 -0
- package/dist/models/RettiwtConfig.js +55 -0
- package/dist/models/RettiwtConfig.js.map +1 -0
- package/dist/models/args/FetchArgs.d.ts +16 -102
- package/dist/models/args/FetchArgs.js +105 -407
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/args/PostArgs.d.ts +16 -73
- package/dist/models/args/PostArgs.js +43 -236
- package/dist/models/args/PostArgs.js.map +1 -1
- package/dist/models/auth/AuthCookie.d.ts +21 -0
- package/dist/models/auth/AuthCookie.js +55 -0
- package/dist/models/auth/AuthCookie.js.map +1 -0
- package/dist/models/auth/AuthCredential.d.ts +30 -0
- package/dist/models/auth/AuthCredential.js +78 -0
- package/dist/models/auth/AuthCredential.js.map +1 -0
- package/dist/models/data/CursoredData.d.ts +5 -15
- package/dist/models/data/CursoredData.js +25 -32
- package/dist/models/data/CursoredData.js.map +1 -1
- package/dist/models/data/List.d.ts +7 -9
- package/dist/models/data/List.js +24 -4
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Notification.d.ts +10 -24
- package/dist/models/data/Notification.js +38 -36
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +34 -31
- package/dist/models/data/Tweet.js +186 -112
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +19 -23
- package/dist/models/data/User.js +92 -32
- package/dist/models/data/User.js.map +1 -1
- package/dist/models/errors/ApiError.js +8 -24
- package/dist/models/errors/ApiError.js.map +1 -1
- package/dist/models/errors/HttpError.js +8 -24
- package/dist/models/errors/HttpError.js.map +1 -1
- package/dist/models/errors/RettiwtError.d.ts +3 -2
- package/dist/models/errors/RettiwtError.js +8 -25
- package/dist/models/errors/RettiwtError.js.map +1 -1
- package/dist/models/errors/TimeoutError.js +5 -22
- package/dist/models/errors/TimeoutError.js.map +1 -1
- package/dist/models/params/Variables.d.ts +41 -0
- package/dist/models/params/Variables.js +61 -0
- package/dist/models/params/Variables.js.map +1 -0
- package/dist/requests/List.d.ts +24 -0
- package/dist/requests/List.js +122 -0
- package/dist/requests/List.js.map +1 -0
- package/dist/requests/Media.d.ts +21 -0
- package/dist/requests/Media.js +70 -0
- package/dist/requests/Media.js.map +1 -0
- package/dist/requests/Tweet.d.ts +75 -0
- package/dist/requests/Tweet.js +480 -0
- package/dist/requests/Tweet.js.map +1 -0
- package/dist/requests/User.d.ts +111 -0
- package/dist/requests/User.js +762 -0
- package/dist/requests/User.js.map +1 -0
- package/dist/services/internal/AuthService.d.ts +60 -0
- package/dist/services/internal/AuthService.js +106 -0
- package/dist/services/internal/AuthService.js.map +1 -0
- package/dist/services/internal/ErrorService.js +38 -40
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/LogService.d.ts +0 -6
- package/dist/services/internal/LogService.js +12 -32
- package/dist/services/internal/LogService.js.map +1 -1
- package/dist/services/internal/TidService.d.ts +44 -0
- package/dist/services/internal/TidService.js +162 -0
- package/dist/services/internal/TidService.js.map +1 -0
- package/dist/services/public/FetcherService.d.ts +22 -19
- package/dist/services/public/FetcherService.js +126 -153
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.d.ts +2 -2
- package/dist/services/public/ListService.js +31 -100
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +63 -10
- package/dist/services/public/TweetService.js +255 -387
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +4 -4
- package/dist/services/public/UserService.js +199 -386
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/RettiwtConfig.d.ts +17 -10
- package/dist/types/args/FetchArgs.d.ts +123 -0
- package/dist/types/{ReturnTypes.js → args/FetchArgs.js} +1 -1
- package/dist/types/args/FetchArgs.js.map +1 -0
- package/dist/types/args/PostArgs.d.ts +100 -0
- package/dist/types/args/PostArgs.js +3 -0
- package/dist/types/args/PostArgs.js.map +1 -0
- package/dist/types/auth/AuthCookie.d.ts +15 -0
- package/dist/types/auth/AuthCookie.js +3 -0
- package/dist/types/auth/AuthCookie.js.map +1 -0
- package/dist/types/auth/AuthCredential.d.ts +23 -0
- package/dist/types/auth/AuthCredential.js +3 -0
- package/dist/types/auth/AuthCredential.js.map +1 -0
- package/dist/types/auth/TidDynamicArgs.d.ts +10 -0
- package/dist/types/auth/TidDynamicArgs.js +3 -0
- package/dist/types/auth/TidDynamicArgs.js.map +1 -0
- package/dist/types/auth/TidHeader.d.ts +8 -0
- package/dist/types/auth/TidHeader.js +3 -0
- package/dist/types/auth/TidHeader.js.map +1 -0
- package/dist/types/auth/TidParams.d.ts +27 -0
- package/dist/types/auth/TidParams.js +3 -0
- package/dist/types/auth/TidParams.js.map +1 -0
- package/dist/types/auth/TidProvider.d.ts +18 -0
- package/dist/types/auth/TidProvider.js +3 -0
- package/dist/types/auth/TidProvider.js.map +1 -0
- package/dist/types/data/CursoredData.d.ts +16 -0
- package/dist/types/data/CursoredData.js +3 -0
- package/dist/types/data/CursoredData.js.map +1 -0
- package/dist/types/data/List.d.ts +21 -0
- package/dist/types/data/List.js +3 -0
- package/dist/types/data/List.js.map +1 -0
- package/dist/types/data/Notification.d.ts +20 -0
- package/dist/types/data/Notification.js +3 -0
- package/dist/types/data/Notification.js.map +1 -0
- package/dist/types/data/Tweet.d.ts +71 -0
- package/dist/types/data/Tweet.js +3 -0
- package/dist/types/data/Tweet.js.map +1 -0
- package/dist/types/data/User.d.ts +35 -0
- package/dist/types/data/User.js +3 -0
- package/dist/types/data/User.js.map +1 -0
- package/dist/types/params/Variables.d.ts +27 -0
- package/dist/types/params/Variables.js +3 -0
- package/dist/types/params/Variables.js.map +1 -0
- package/dist/types/raw/base/Analytic.d.ts +21 -0
- package/dist/types/raw/base/Analytic.js +4 -0
- package/dist/types/raw/base/Analytic.js.map +1 -0
- package/dist/types/raw/base/Cursor.d.ts +11 -0
- package/dist/types/raw/base/Cursor.js +4 -0
- package/dist/types/raw/base/Cursor.js.map +1 -0
- package/dist/types/raw/base/LimitedVisibilityTweet.d.ts +32 -0
- package/dist/types/raw/base/LimitedVisibilityTweet.js +4 -0
- package/dist/types/raw/base/LimitedVisibilityTweet.js.map +1 -0
- package/dist/types/raw/base/List.d.ts +43 -0
- package/dist/types/raw/base/List.js +4 -0
- package/dist/types/raw/base/List.js.map +1 -0
- package/dist/types/raw/base/Media.d.ts +43 -0
- package/dist/types/raw/base/Media.js +4 -0
- package/dist/types/raw/base/Media.js.map +1 -0
- package/dist/types/raw/base/Notification.d.ts +53 -0
- package/dist/types/raw/base/Notification.js +4 -0
- package/dist/types/raw/base/Notification.js.map +1 -0
- package/dist/types/raw/base/Space.d.ts +32 -0
- package/dist/types/raw/base/Space.js +4 -0
- package/dist/types/raw/base/Space.js.map +1 -0
- package/dist/types/raw/base/Tweet.d.ts +119 -0
- package/dist/types/raw/base/Tweet.js +4 -0
- package/dist/types/raw/base/Tweet.js.map +1 -0
- package/dist/types/raw/base/User.d.ts +140 -0
- package/dist/types/raw/base/User.js +4 -0
- package/dist/types/raw/base/User.js.map +1 -0
- package/dist/types/raw/composite/DataResult.d.ts +8 -0
- package/dist/types/raw/composite/DataResult.js +3 -0
- package/dist/types/raw/composite/DataResult.js.map +1 -0
- package/dist/types/raw/composite/TimelineTweet.d.ts +11 -0
- package/dist/types/raw/composite/TimelineTweet.js +4 -0
- package/dist/types/raw/composite/TimelineTweet.js.map +1 -0
- package/dist/types/raw/composite/TimelineUser.d.ts +10 -0
- package/dist/types/raw/composite/TimelineUser.js +4 -0
- package/dist/types/raw/composite/TimelineUser.js.map +1 -0
- package/dist/types/raw/generic/Error.d.ts +30 -0
- package/dist/types/raw/generic/Error.js +3 -0
- package/dist/types/raw/generic/Error.js.map +1 -0
- package/dist/types/raw/generic/Response.d.ts +12 -0
- package/dist/types/raw/generic/Response.js +3 -0
- package/dist/types/raw/generic/Response.js.map +1 -0
- package/dist/types/raw/list/Details.d.ts +122 -0
- package/dist/types/raw/list/Details.js +4 -0
- package/dist/types/raw/list/Details.js.map +1 -0
- package/dist/types/raw/list/Members.d.ts +134 -0
- package/dist/types/raw/list/Members.js +4 -0
- package/dist/types/raw/list/Members.js.map +1 -0
- package/dist/types/raw/list/Tweets.d.ts +1968 -0
- package/dist/types/raw/list/Tweets.js +4 -0
- package/dist/types/raw/list/Tweets.js.map +1 -0
- package/dist/types/raw/media/FinalizeUpload.d.ts +18 -0
- package/dist/types/raw/media/FinalizeUpload.js +4 -0
- package/dist/types/raw/media/FinalizeUpload.js.map +1 -0
- package/dist/types/raw/media/InitalizeUpload.d.ts +10 -0
- package/dist/types/raw/media/InitalizeUpload.js +4 -0
- package/dist/types/raw/media/InitalizeUpload.js.map +1 -0
- package/dist/types/raw/media/LiveVideoStream.d.ts +19 -0
- package/dist/types/raw/media/LiveVideoStream.js +4 -0
- package/dist/types/raw/media/LiveVideoStream.js.map +1 -0
- package/dist/types/raw/space/Details.d.ts +315 -0
- package/dist/types/raw/space/Details.js +4 -0
- package/dist/types/raw/space/Details.js.map +1 -0
- package/dist/types/raw/tweet/Details.d.ts +183 -0
- package/dist/types/raw/tweet/Details.js +4 -0
- package/dist/types/raw/tweet/Details.js.map +1 -0
- package/dist/types/raw/tweet/Like.d.ts +12 -0
- package/dist/types/raw/tweet/Like.js +4 -0
- package/dist/types/raw/tweet/Like.js.map +1 -0
- package/dist/types/raw/tweet/Likers.d.ts +170 -0
- package/dist/types/raw/tweet/Likers.js +4 -0
- package/dist/types/raw/tweet/Likers.js.map +1 -0
- package/dist/types/raw/tweet/Post.d.ts +133 -0
- package/dist/types/raw/tweet/Post.js +4 -0
- package/dist/types/raw/tweet/Post.js.map +1 -0
- package/dist/types/raw/tweet/Replies.d.ts +465 -0
- package/dist/types/raw/tweet/Replies.js +4 -0
- package/dist/types/raw/tweet/Replies.js.map +1 -0
- package/dist/types/raw/tweet/Retweet.d.ts +25 -0
- package/dist/types/raw/tweet/Retweet.js +4 -0
- package/dist/types/raw/tweet/Retweet.js.map +1 -0
- package/dist/types/raw/tweet/Retweeters.d.ts +177 -0
- package/dist/types/raw/tweet/Retweeters.js +4 -0
- package/dist/types/raw/tweet/Retweeters.js.map +1 -0
- package/dist/types/raw/tweet/Schedule.d.ts +15 -0
- package/dist/types/raw/tweet/Schedule.js +4 -0
- package/dist/types/raw/tweet/Schedule.js.map +1 -0
- package/dist/types/raw/tweet/Search.d.ts +518 -0
- package/dist/types/raw/tweet/Search.js +4 -0
- package/dist/types/raw/tweet/Search.js.map +1 -0
- package/dist/types/raw/tweet/Unlike.d.ts +12 -0
- package/dist/types/raw/tweet/Unlike.js +4 -0
- package/dist/types/raw/tweet/Unlike.js.map +1 -0
- package/dist/types/raw/tweet/Unpost.d.ts +17 -0
- package/dist/types/raw/tweet/Unpost.js +4 -0
- package/dist/types/raw/tweet/Unpost.js.map +1 -0
- package/dist/types/raw/tweet/Unretweet.d.ts +25 -0
- package/dist/types/raw/tweet/Unretweet.js +4 -0
- package/dist/types/raw/tweet/Unretweet.js.map +1 -0
- package/dist/types/raw/tweet/Unschedule.d.ts +12 -0
- package/dist/types/raw/tweet/Unschedule.js +4 -0
- package/dist/types/raw/tweet/Unschedule.js.map +1 -0
- package/dist/types/raw/user/Affiliates.d.ts +154 -0
- package/dist/types/raw/user/Affiliates.js +4 -0
- package/dist/types/raw/user/Affiliates.js.map +1 -0
- package/dist/types/raw/user/Analytics.d.ts +32 -0
- package/dist/types/raw/user/Analytics.js +4 -0
- package/dist/types/raw/user/Analytics.js.map +1 -0
- package/dist/types/raw/user/Bookmarks.d.ts +550 -0
- package/dist/types/raw/user/Bookmarks.js +4 -0
- package/dist/types/raw/user/Bookmarks.js.map +1 -0
- package/dist/types/raw/user/Details.d.ts +157 -0
- package/dist/types/raw/user/Details.js +4 -0
- package/dist/types/raw/user/Details.js.map +1 -0
- package/dist/types/raw/user/Follow.d.ts +248 -0
- package/dist/types/raw/user/Follow.js +4 -0
- package/dist/types/raw/user/Follow.js.map +1 -0
- package/dist/types/raw/user/Followed.d.ts +1666 -0
- package/dist/types/raw/user/Followed.js +4 -0
- package/dist/types/raw/user/Followed.js.map +1 -0
- package/dist/types/raw/user/Followers.d.ts +182 -0
- package/dist/types/raw/user/Followers.js +4 -0
- package/dist/types/raw/user/Followers.js.map +1 -0
- package/dist/types/raw/user/Following.d.ts +182 -0
- package/dist/types/raw/user/Following.js +4 -0
- package/dist/types/raw/user/Following.js.map +1 -0
- package/dist/types/raw/user/Highlights.d.ts +1106 -0
- package/dist/types/raw/user/Highlights.js +4 -0
- package/dist/types/raw/user/Highlights.js.map +1 -0
- package/dist/types/raw/user/Likes.d.ts +1065 -0
- package/dist/types/raw/user/Likes.js +4 -0
- package/dist/types/raw/user/Likes.js.map +1 -0
- package/dist/types/raw/user/Media.d.ts +1492 -0
- package/dist/types/raw/user/Media.js +4 -0
- package/dist/types/raw/user/Media.js.map +1 -0
- package/dist/types/raw/user/Notifications.d.ts +142 -0
- package/dist/types/raw/user/Notifications.js +4 -0
- package/dist/types/raw/user/Notifications.js.map +1 -0
- package/dist/types/raw/user/Recommended.d.ts +1991 -0
- package/dist/types/raw/user/Recommended.js +4 -0
- package/dist/types/raw/user/Recommended.js.map +1 -0
- package/dist/types/raw/user/Scheduled.d.ts +31 -0
- package/dist/types/raw/user/Scheduled.js +4 -0
- package/dist/types/raw/user/Scheduled.js.map +1 -0
- package/dist/types/raw/user/Subscriptions.d.ts +151 -0
- package/dist/types/raw/user/Subscriptions.js +4 -0
- package/dist/types/raw/user/Subscriptions.js.map +1 -0
- package/dist/types/raw/user/Tweets.d.ts +1065 -0
- package/dist/types/raw/user/Tweets.js +4 -0
- package/dist/types/raw/user/Tweets.js.map +1 -0
- package/dist/types/raw/user/TweetsAndReplies.d.ts +1065 -0
- package/dist/types/raw/user/TweetsAndReplies.js +4 -0
- package/dist/types/raw/user/TweetsAndReplies.js.map +1 -0
- package/dist/types/raw/user/Unfollow.d.ts +248 -0
- package/dist/types/raw/user/Unfollow.js +4 -0
- package/dist/types/raw/user/Unfollow.js.map +1 -0
- package/eslint.config.mjs +17 -0
- package/package.json +22 -19
- package/src/Rettiwt.ts +22 -7
- package/src/cli.ts +0 -2
- package/src/collections/Extractors.ts +40 -34
- package/src/collections/Groups.ts +4 -0
- package/src/collections/Requests.ts +46 -44
- package/src/commands/Tweet.ts +35 -7
- package/src/commands/User.ts +13 -2
- package/src/enums/Authentication.ts +10 -0
- package/src/enums/Data.ts +3 -3
- package/src/enums/Media.ts +10 -0
- package/src/enums/Notification.ts +12 -0
- package/src/enums/Resource.ts +4 -0
- package/src/enums/raw/Analytics.ts +29 -0
- package/src/enums/raw/Media.ts +10 -0
- package/src/enums/raw/Notification.ts +11 -0
- package/src/enums/raw/Tweet.ts +9 -0
- package/src/helper/JsonUtils.ts +1 -1
- package/src/helper/TidUtils.ts +189 -0
- package/src/index.ts +78 -44
- package/src/models/RettiwtConfig.ts +64 -0
- package/src/models/args/FetchArgs.ts +86 -436
- package/src/models/args/PostArgs.ts +24 -249
- package/src/models/auth/AuthCookie.ts +58 -0
- package/src/models/auth/AuthCredential.ts +85 -0
- package/src/models/data/CursoredData.ts +21 -26
- package/src/models/data/List.ts +18 -15
- package/src/models/data/Notification.ts +25 -38
- package/src/models/data/Tweet.ts +143 -104
- package/src/models/data/User.ts +74 -44
- package/src/models/errors/RettiwtError.ts +3 -2
- package/src/models/params/Variables.ts +62 -0
- package/src/requests/List.ts +121 -0
- package/src/requests/Media.ts +67 -0
- package/src/requests/Tweet.ts +496 -0
- package/src/requests/User.ts +783 -0
- package/src/services/{public → internal}/AuthService.ts +28 -60
- package/src/services/internal/LogService.ts +4 -19
- package/src/services/internal/TidService.ts +147 -0
- package/src/services/public/FetcherService.ts +89 -59
- package/src/services/public/ListService.ts +4 -4
- package/src/services/public/TweetService.ts +129 -42
- package/src/services/public/UserService.ts +49 -37
- package/src/types/RettiwtConfig.ts +18 -12
- package/src/types/args/FetchArgs.ts +148 -0
- package/src/types/args/PostArgs.ts +112 -0
- package/src/types/auth/AuthCookie.ts +22 -0
- package/src/types/auth/AuthCredential.ts +28 -0
- package/src/types/auth/TidDynamicArgs.ts +10 -0
- package/src/types/auth/TidHeader.ts +12 -0
- package/src/types/auth/TidParams.ts +36 -0
- package/src/types/auth/TidProvider.ts +19 -0
- package/src/types/data/CursoredData.ts +18 -0
- package/src/types/data/List.ts +27 -0
- package/src/types/data/Notification.ts +26 -0
- package/src/types/data/Tweet.ts +96 -0
- package/src/types/data/User.ts +48 -0
- package/src/types/params/Variables.ts +41 -0
- package/src/types/raw/base/Analytic.ts +26 -0
- package/src/types/raw/base/Cursor.ts +13 -0
- package/src/types/raw/base/LimitedVisibilityTweet.ts +40 -0
- package/src/types/raw/base/List.ts +50 -0
- package/src/types/raw/base/Media.ts +53 -0
- package/src/types/raw/base/Notification.ts +67 -0
- package/src/types/raw/base/Space.ts +35 -0
- package/src/types/raw/base/Tweet.ts +139 -0
- package/src/types/raw/base/User.ts +164 -0
- package/src/types/raw/composite/DataResult.ts +8 -0
- package/src/types/raw/composite/TimelineTweet.ts +14 -0
- package/src/types/raw/composite/TimelineUser.ts +13 -0
- package/src/types/raw/generic/Error.ts +35 -0
- package/src/types/raw/generic/Response.ts +13 -0
- package/src/types/raw/list/Details.ts +137 -0
- package/src/types/raw/list/Members.ts +154 -0
- package/src/types/raw/list/Tweets.ts +2296 -0
- package/src/types/raw/media/FinalizeUpload.ts +20 -0
- package/src/types/raw/media/InitalizeUpload.ts +12 -0
- package/src/types/raw/media/LiveVideoStream.ts +21 -0
- package/src/types/raw/space/Details.ts +359 -0
- package/src/types/raw/tweet/Details.ts +210 -0
- package/src/types/raw/tweet/Like.ts +14 -0
- package/src/types/raw/tweet/Likers.ts +200 -0
- package/src/types/raw/tweet/Post.ts +150 -0
- package/src/types/raw/tweet/Replies.ts +539 -0
- package/src/types/raw/tweet/Retweet.ts +31 -0
- package/src/types/raw/tweet/Retweeters.ts +208 -0
- package/src/types/raw/tweet/Schedule.ts +18 -0
- package/src/types/raw/tweet/Search.ts +597 -0
- package/src/types/raw/tweet/Unlike.ts +14 -0
- package/src/types/raw/tweet/Unpost.ts +20 -0
- package/src/types/raw/tweet/Unretweet.ts +31 -0
- package/src/types/raw/tweet/Unschedule.ts +14 -0
- package/src/types/raw/user/Affiliates.ts +179 -0
- package/src/types/raw/user/Analytics.ts +39 -0
- package/src/types/raw/user/Bookmarks.ts +637 -0
- package/src/types/raw/user/Details.ts +185 -0
- package/src/types/raw/user/Follow.ts +280 -0
- package/src/types/raw/user/Followed.ts +1942 -0
- package/src/types/raw/user/Followers.ts +215 -0
- package/src/types/raw/user/Following.ts +215 -0
- package/src/types/raw/user/Highlights.ts +1287 -0
- package/src/types/raw/user/Likes.ts +1254 -0
- package/src/types/raw/user/Media.ts +1738 -0
- package/src/types/raw/user/Notifications.ts +175 -0
- package/src/types/raw/user/Recommended.ts +2319 -0
- package/src/types/raw/user/Scheduled.ts +37 -0
- package/src/types/raw/user/Subscriptions.ts +176 -0
- package/src/types/raw/user/Tweets.ts +1254 -0
- package/src/types/raw/user/TweetsAndReplies.ts +1254 -0
- package/src/types/raw/user/Unfollow.ts +280 -0
- package/tsconfig.json +7 -5
- package/.eslintignore +0 -3
- package/dist/commands/Auth.d.ts +0 -10
- package/dist/commands/Auth.js +0 -101
- package/dist/commands/Auth.js.map +0 -1
- package/dist/models/errors/DataValidationError.d.ts +0 -30
- package/dist/models/errors/DataValidationError.js +0 -34
- package/dist/models/errors/DataValidationError.js.map +0 -1
- package/dist/services/public/AuthService.d.ts +0 -91
- package/dist/services/public/AuthService.js +0 -205
- package/dist/services/public/AuthService.js.map +0 -1
- package/dist/types/ReturnTypes.d.ts +0 -21
- package/dist/types/ReturnTypes.js.map +0 -1
- package/src/commands/Auth.ts +0 -46
- package/src/models/errors/DataValidationError.ts +0 -44
- package/src/types/ReturnTypes.ts +0 -24
|
@@ -1,86 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
54
|
-
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
55
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
56
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
57
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
58
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
59
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
60
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
61
|
-
function fulfill(value) { resume("next", value); }
|
|
62
|
-
function reject(value) { resume("throw", value); }
|
|
63
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
64
|
-
};
|
|
65
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
3
|
exports.UserService = void 0;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
4
|
+
const Extractors_1 = require("../../collections/Extractors");
|
|
5
|
+
const Resource_1 = require("../../enums/Resource");
|
|
6
|
+
const FetcherService_1 = require("./FetcherService");
|
|
70
7
|
/**
|
|
71
8
|
* Handles interacting with resources related to user account
|
|
72
9
|
*
|
|
73
10
|
* @public
|
|
74
11
|
*/
|
|
75
|
-
|
|
76
|
-
__extends(UserService, _super);
|
|
12
|
+
class UserService extends FetcherService_1.FetcherService {
|
|
77
13
|
/**
|
|
78
14
|
* @param config - The config object for configuring the Rettiwt instance.
|
|
79
15
|
*
|
|
80
16
|
* @internal
|
|
81
17
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
18
|
+
constructor(config) {
|
|
19
|
+
super(config);
|
|
84
20
|
}
|
|
85
21
|
/**
|
|
86
22
|
* Get the list of bookmarks of the logged in user.
|
|
@@ -107,29 +43,21 @@ var UserService = /** @class */ (function (_super) {
|
|
|
107
43
|
* });
|
|
108
44
|
* ```
|
|
109
45
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
resource = Resource_1.EResourceType.USER_BOOKMARKS;
|
|
117
|
-
return [4 /*yield*/, this.request(resource, {
|
|
118
|
-
count: count,
|
|
119
|
-
cursor: cursor,
|
|
120
|
-
})];
|
|
121
|
-
case 1:
|
|
122
|
-
response = _a.sent();
|
|
123
|
-
data = Extractors_1.extractors[resource](response);
|
|
124
|
-
return [2 /*return*/, data];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
46
|
+
async bookmarks(count, cursor) {
|
|
47
|
+
const resource = Resource_1.EResourceType.USER_BOOKMARKS;
|
|
48
|
+
// Fetching raw list of likes
|
|
49
|
+
const response = await this.request(resource, {
|
|
50
|
+
count: count,
|
|
51
|
+
cursor: cursor,
|
|
127
52
|
});
|
|
128
|
-
|
|
53
|
+
// Deserializing response
|
|
54
|
+
const data = Extractors_1.extractors[resource](response);
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
129
57
|
/**
|
|
130
58
|
* Get the details of a user.
|
|
131
59
|
*
|
|
132
|
-
* @param id - The username/id of the target user.
|
|
60
|
+
* @param id - The username/id(s) of the target user/users.
|
|
133
61
|
*
|
|
134
62
|
* @returns
|
|
135
63
|
* The details of the given user.
|
|
@@ -171,29 +99,34 @@ var UserService = /** @class */ (function (_super) {
|
|
|
171
99
|
* });
|
|
172
100
|
* ```
|
|
173
101
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
102
|
+
async details(id) {
|
|
103
|
+
let resource;
|
|
104
|
+
// If details of multiple users required
|
|
105
|
+
if (Array.isArray(id)) {
|
|
106
|
+
resource = Resource_1.EResourceType.USER_DETAILS_BY_IDS_BULK;
|
|
107
|
+
// Fetching raw details
|
|
108
|
+
const response = await this.request(resource, { ids: id });
|
|
109
|
+
// Deserializing response
|
|
110
|
+
const data = Extractors_1.extractors[resource](response, id);
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
// If details of single user required
|
|
114
|
+
else {
|
|
115
|
+
// If username is given
|
|
116
|
+
if (isNaN(Number(id))) {
|
|
117
|
+
resource = Resource_1.EResourceType.USER_DETAILS_BY_USERNAME;
|
|
118
|
+
}
|
|
119
|
+
// If id is given
|
|
120
|
+
else {
|
|
121
|
+
resource = Resource_1.EResourceType.USER_DETAILS_BY_ID;
|
|
122
|
+
}
|
|
123
|
+
// Fetching raw details
|
|
124
|
+
const response = await this.request(resource, { id: id });
|
|
125
|
+
// Deserializing response
|
|
126
|
+
const data = Extractors_1.extractors[resource](response);
|
|
127
|
+
return data;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
197
130
|
/**
|
|
198
131
|
* Follow a user.
|
|
199
132
|
*
|
|
@@ -220,23 +153,14 @@ var UserService = /** @class */ (function (_super) {
|
|
|
220
153
|
* });
|
|
221
154
|
* ```
|
|
222
155
|
*/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return [4 /*yield*/, this.request(Resource_1.EResourceType.USER_FOLLOW, { id: id })];
|
|
232
|
-
case 1:
|
|
233
|
-
response = _b.sent();
|
|
234
|
-
data = (_a = Extractors_1.extractors[resource](response)) !== null && _a !== void 0 ? _a : false;
|
|
235
|
-
return [2 /*return*/, data];
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
};
|
|
156
|
+
async follow(id) {
|
|
157
|
+
const resource = Resource_1.EResourceType.USER_FOLLOW;
|
|
158
|
+
// Following the user
|
|
159
|
+
const response = await this.request(Resource_1.EResourceType.USER_FOLLOW, { id: id });
|
|
160
|
+
// Deserializing the response
|
|
161
|
+
const data = Extractors_1.extractors[resource](response) ?? false;
|
|
162
|
+
return data;
|
|
163
|
+
}
|
|
240
164
|
/**
|
|
241
165
|
* Get the followed feed of the logged in user.
|
|
242
166
|
*
|
|
@@ -263,24 +187,16 @@ var UserService = /** @class */ (function (_super) {
|
|
|
263
187
|
*
|
|
264
188
|
* @remarks Always returns 35 feed items, with no way to customize the count.
|
|
265
189
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
case 0:
|
|
272
|
-
resource = Resource_1.EResourceType.USER_FEED_FOLLOWED;
|
|
273
|
-
return [4 /*yield*/, this.request(resource, {
|
|
274
|
-
cursor: cursor,
|
|
275
|
-
})];
|
|
276
|
-
case 1:
|
|
277
|
-
response = _a.sent();
|
|
278
|
-
data = Extractors_1.extractors[resource](response);
|
|
279
|
-
return [2 /*return*/, data];
|
|
280
|
-
}
|
|
281
|
-
});
|
|
190
|
+
async followed(cursor) {
|
|
191
|
+
const resource = Resource_1.EResourceType.USER_FEED_FOLLOWED;
|
|
192
|
+
// Fetching raw list of tweets
|
|
193
|
+
const response = await this.request(resource, {
|
|
194
|
+
cursor: cursor,
|
|
282
195
|
});
|
|
283
|
-
|
|
196
|
+
// Deserializing response
|
|
197
|
+
const data = Extractors_1.extractors[resource](response);
|
|
198
|
+
return data;
|
|
199
|
+
}
|
|
284
200
|
/**
|
|
285
201
|
* Get the list followers of a user.
|
|
286
202
|
*
|
|
@@ -307,26 +223,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
307
223
|
* });
|
|
308
224
|
* ```
|
|
309
225
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return [4 /*yield*/, this.request(resource, {
|
|
318
|
-
id: id,
|
|
319
|
-
count: count,
|
|
320
|
-
cursor: cursor,
|
|
321
|
-
})];
|
|
322
|
-
case 1:
|
|
323
|
-
response = _a.sent();
|
|
324
|
-
data = Extractors_1.extractors[resource](response);
|
|
325
|
-
return [2 /*return*/, data];
|
|
326
|
-
}
|
|
327
|
-
});
|
|
226
|
+
async followers(id, count, cursor) {
|
|
227
|
+
const resource = Resource_1.EResourceType.USER_FOLLOWERS;
|
|
228
|
+
// Fetching raw list of followers
|
|
229
|
+
const response = await this.request(resource, {
|
|
230
|
+
id: id,
|
|
231
|
+
count: count,
|
|
232
|
+
cursor: cursor,
|
|
328
233
|
});
|
|
329
|
-
|
|
234
|
+
// Deserializing response
|
|
235
|
+
const data = Extractors_1.extractors[resource](response);
|
|
236
|
+
return data;
|
|
237
|
+
}
|
|
330
238
|
/**
|
|
331
239
|
* Get the list of users who are followed by a user.
|
|
332
240
|
*
|
|
@@ -353,26 +261,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
353
261
|
* });
|
|
354
262
|
* ```
|
|
355
263
|
*/
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
return [4 /*yield*/, this.request(resource, {
|
|
364
|
-
id: id,
|
|
365
|
-
count: count,
|
|
366
|
-
cursor: cursor,
|
|
367
|
-
})];
|
|
368
|
-
case 1:
|
|
369
|
-
response = _a.sent();
|
|
370
|
-
data = Extractors_1.extractors[resource](response);
|
|
371
|
-
return [2 /*return*/, data];
|
|
372
|
-
}
|
|
373
|
-
});
|
|
264
|
+
async following(id, count, cursor) {
|
|
265
|
+
const resource = Resource_1.EResourceType.USER_FOLLOWING;
|
|
266
|
+
// Fetching raw list of following
|
|
267
|
+
const response = await this.request(resource, {
|
|
268
|
+
id: id,
|
|
269
|
+
count: count,
|
|
270
|
+
cursor: cursor,
|
|
374
271
|
});
|
|
375
|
-
|
|
272
|
+
// Deserializing response
|
|
273
|
+
const data = Extractors_1.extractors[resource](response);
|
|
274
|
+
return data;
|
|
275
|
+
}
|
|
376
276
|
/**
|
|
377
277
|
* Get the highlighted tweets of a user.
|
|
378
278
|
*
|
|
@@ -399,26 +299,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
399
299
|
* });
|
|
400
300
|
* ```
|
|
401
301
|
*/
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return [4 /*yield*/, this.request(resource, {
|
|
410
|
-
id: id,
|
|
411
|
-
count: count,
|
|
412
|
-
cursor: cursor,
|
|
413
|
-
})];
|
|
414
|
-
case 1:
|
|
415
|
-
response = _a.sent();
|
|
416
|
-
data = Extractors_1.extractors[resource](response);
|
|
417
|
-
return [2 /*return*/, data];
|
|
418
|
-
}
|
|
419
|
-
});
|
|
302
|
+
async highlights(id, count, cursor) {
|
|
303
|
+
const resource = Resource_1.EResourceType.USER_HIGHLIGHTS;
|
|
304
|
+
// Fetching raw list of highlights
|
|
305
|
+
const response = await this.request(resource, {
|
|
306
|
+
id: id,
|
|
307
|
+
count: count,
|
|
308
|
+
cursor: cursor,
|
|
420
309
|
});
|
|
421
|
-
|
|
310
|
+
// Deserializing response
|
|
311
|
+
const data = Extractors_1.extractors[resource](response);
|
|
312
|
+
return data;
|
|
313
|
+
}
|
|
422
314
|
/**
|
|
423
315
|
* Get the list of tweets liked by the logged in user.
|
|
424
316
|
*
|
|
@@ -444,26 +336,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
444
336
|
* });
|
|
445
337
|
* ```
|
|
446
338
|
*/
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
return [4 /*yield*/, this.request(resource, {
|
|
455
|
-
id: this.userId,
|
|
456
|
-
count: count,
|
|
457
|
-
cursor: cursor,
|
|
458
|
-
})];
|
|
459
|
-
case 1:
|
|
460
|
-
response = _a.sent();
|
|
461
|
-
data = Extractors_1.extractors[resource](response);
|
|
462
|
-
return [2 /*return*/, data];
|
|
463
|
-
}
|
|
464
|
-
});
|
|
339
|
+
async likes(count, cursor) {
|
|
340
|
+
const resource = Resource_1.EResourceType.USER_LIKES;
|
|
341
|
+
// Fetching raw list of likes
|
|
342
|
+
const response = await this.request(resource, {
|
|
343
|
+
id: this.config.userId,
|
|
344
|
+
count: count,
|
|
345
|
+
cursor: cursor,
|
|
465
346
|
});
|
|
466
|
-
|
|
347
|
+
// Deserializing response
|
|
348
|
+
const data = Extractors_1.extractors[resource](response);
|
|
349
|
+
return data;
|
|
350
|
+
}
|
|
467
351
|
/**
|
|
468
352
|
* Get the media timeline of a user.
|
|
469
353
|
*
|
|
@@ -490,26 +374,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
490
374
|
* });
|
|
491
375
|
* ```
|
|
492
376
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
return [4 /*yield*/, this.request(resource, {
|
|
501
|
-
id: id,
|
|
502
|
-
count: count,
|
|
503
|
-
cursor: cursor,
|
|
504
|
-
})];
|
|
505
|
-
case 1:
|
|
506
|
-
response = _a.sent();
|
|
507
|
-
data = Extractors_1.extractors[resource](response);
|
|
508
|
-
return [2 /*return*/, data];
|
|
509
|
-
}
|
|
510
|
-
});
|
|
377
|
+
async media(id, count, cursor) {
|
|
378
|
+
const resource = Resource_1.EResourceType.USER_MEDIA;
|
|
379
|
+
// Fetching raw list of media
|
|
380
|
+
const response = await this.request(resource, {
|
|
381
|
+
id: id,
|
|
382
|
+
count: count,
|
|
383
|
+
cursor: cursor,
|
|
511
384
|
});
|
|
512
|
-
|
|
385
|
+
// Deserializing response
|
|
386
|
+
const data = Extractors_1.extractors[resource](response);
|
|
387
|
+
return data;
|
|
388
|
+
}
|
|
513
389
|
/**
|
|
514
390
|
* Stream notifications of the logged in user in pseudo real-time.
|
|
515
391
|
*
|
|
@@ -541,59 +417,38 @@ var UserService = /** @class */ (function (_super) {
|
|
|
541
417
|
* streamNotifications();
|
|
542
418
|
* ```
|
|
543
419
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
// Pause execution for the specified polling interval before proceeding to the next iteration
|
|
558
|
-
return [4 /*yield*/, __await(new Promise(function (resolve) { return setTimeout(resolve, pollingInterval); }))];
|
|
559
|
-
case 2:
|
|
560
|
-
// Pause execution for the specified polling interval before proceeding to the next iteration
|
|
561
|
-
_b.sent();
|
|
562
|
-
return [4 /*yield*/, __await(this.request(resource, {
|
|
563
|
-
count: 40,
|
|
564
|
-
cursor: cursor,
|
|
565
|
-
}))];
|
|
566
|
-
case 3:
|
|
567
|
-
response = _b.sent();
|
|
568
|
-
notifications = Extractors_1.extractors[resource](response);
|
|
569
|
-
// Sorting the notifications by time, from oldest to recent
|
|
570
|
-
notifications.list.sort(function (a, b) { return new Date(a.receivedAt).valueOf() - new Date(b.receivedAt).valueOf(); });
|
|
571
|
-
if (!!first) return [3 /*break*/, 9];
|
|
572
|
-
_i = 0, _a = notifications.list;
|
|
573
|
-
_b.label = 4;
|
|
574
|
-
case 4:
|
|
575
|
-
if (!(_i < _a.length)) return [3 /*break*/, 8];
|
|
576
|
-
notification = _a[_i];
|
|
577
|
-
return [4 /*yield*/, __await(notification)];
|
|
578
|
-
case 5: return [4 /*yield*/, _b.sent()];
|
|
579
|
-
case 6:
|
|
580
|
-
_b.sent();
|
|
581
|
-
_b.label = 7;
|
|
582
|
-
case 7:
|
|
583
|
-
_i++;
|
|
584
|
-
return [3 /*break*/, 4];
|
|
585
|
-
case 8: return [3 /*break*/, 10];
|
|
586
|
-
case 9:
|
|
587
|
-
first = false;
|
|
588
|
-
_b.label = 10;
|
|
589
|
-
case 10:
|
|
590
|
-
cursor = notifications.next.value;
|
|
591
|
-
return [3 /*break*/, 1];
|
|
592
|
-
case 11: return [2 /*return*/];
|
|
593
|
-
}
|
|
420
|
+
async *notifications(pollingInterval = 60000) {
|
|
421
|
+
const resource = Resource_1.EResourceType.USER_NOTIFICATIONS;
|
|
422
|
+
/** Whether it's the first batch of notifications or not. */
|
|
423
|
+
let first = true;
|
|
424
|
+
/** The cursor to the last notification received. */
|
|
425
|
+
let cursor = undefined;
|
|
426
|
+
while (true) {
|
|
427
|
+
// Pause execution for the specified polling interval before proceeding to the next iteration
|
|
428
|
+
await new Promise((resolve) => setTimeout(resolve, pollingInterval));
|
|
429
|
+
// Get the batch of notifications after the given cursor
|
|
430
|
+
const response = await this.request(resource, {
|
|
431
|
+
count: 40,
|
|
432
|
+
cursor: cursor,
|
|
594
433
|
});
|
|
595
|
-
|
|
596
|
-
|
|
434
|
+
// Deserializing response
|
|
435
|
+
const notifications = Extractors_1.extractors[resource](response);
|
|
436
|
+
// Sorting the notifications by time, from oldest to recent
|
|
437
|
+
notifications.list.sort((a, b) => new Date(a.receivedAt).valueOf() - new Date(b.receivedAt).valueOf());
|
|
438
|
+
// If not first batch, return new notifications
|
|
439
|
+
if (!first) {
|
|
440
|
+
// Yield the notifications
|
|
441
|
+
for (const notification of notifications.list) {
|
|
442
|
+
yield notification;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
// Else do nothing, do nothing since first batch is notifications that have already been received
|
|
446
|
+
else {
|
|
447
|
+
first = false;
|
|
448
|
+
}
|
|
449
|
+
cursor = notifications.next;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
597
452
|
/**
|
|
598
453
|
* Get the recommended feed of the logged in user.
|
|
599
454
|
*
|
|
@@ -620,24 +475,16 @@ var UserService = /** @class */ (function (_super) {
|
|
|
620
475
|
*
|
|
621
476
|
* @remarks Always returns 35 feed items, with no way to customize the count.
|
|
622
477
|
*/
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
case 0:
|
|
629
|
-
resource = Resource_1.EResourceType.USER_FEED_RECOMMENDED;
|
|
630
|
-
return [4 /*yield*/, this.request(resource, {
|
|
631
|
-
cursor: cursor,
|
|
632
|
-
})];
|
|
633
|
-
case 1:
|
|
634
|
-
response = _a.sent();
|
|
635
|
-
data = Extractors_1.extractors[resource](response);
|
|
636
|
-
return [2 /*return*/, data];
|
|
637
|
-
}
|
|
638
|
-
});
|
|
478
|
+
async recommended(cursor) {
|
|
479
|
+
const resource = Resource_1.EResourceType.USER_FEED_RECOMMENDED;
|
|
480
|
+
// Fetching raw list of tweets
|
|
481
|
+
const response = await this.request(resource, {
|
|
482
|
+
cursor: cursor,
|
|
639
483
|
});
|
|
640
|
-
|
|
484
|
+
// Deserializing response
|
|
485
|
+
const data = Extractors_1.extractors[resource](response);
|
|
486
|
+
return data;
|
|
487
|
+
}
|
|
641
488
|
/**
|
|
642
489
|
* Get the reply timeline of a user.
|
|
643
490
|
*
|
|
@@ -666,26 +513,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
666
513
|
*
|
|
667
514
|
* @remarks If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
|
|
668
515
|
*/
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
return [4 /*yield*/, this.request(resource, {
|
|
677
|
-
id: id,
|
|
678
|
-
count: count,
|
|
679
|
-
cursor: cursor,
|
|
680
|
-
})];
|
|
681
|
-
case 1:
|
|
682
|
-
response = _a.sent();
|
|
683
|
-
data = Extractors_1.extractors[resource](response);
|
|
684
|
-
return [2 /*return*/, data];
|
|
685
|
-
}
|
|
686
|
-
});
|
|
516
|
+
async replies(id, count, cursor) {
|
|
517
|
+
const resource = Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES;
|
|
518
|
+
// Fetching raw list of replies
|
|
519
|
+
const response = await this.request(resource, {
|
|
520
|
+
id: id,
|
|
521
|
+
count: count,
|
|
522
|
+
cursor: cursor,
|
|
687
523
|
});
|
|
688
|
-
|
|
524
|
+
// Deserializing response
|
|
525
|
+
const data = Extractors_1.extractors[resource](response);
|
|
526
|
+
return data;
|
|
527
|
+
}
|
|
689
528
|
/**
|
|
690
529
|
* Get the list of subscriptions of a user.
|
|
691
530
|
*
|
|
@@ -712,26 +551,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
712
551
|
* });
|
|
713
552
|
* ```
|
|
714
553
|
*/
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
return [4 /*yield*/, this.request(resource, {
|
|
723
|
-
id: id,
|
|
724
|
-
count: count,
|
|
725
|
-
cursor: cursor,
|
|
726
|
-
})];
|
|
727
|
-
case 1:
|
|
728
|
-
response = _a.sent();
|
|
729
|
-
data = Extractors_1.extractors[resource](response);
|
|
730
|
-
return [2 /*return*/, data];
|
|
731
|
-
}
|
|
732
|
-
});
|
|
554
|
+
async subscriptions(id, count, cursor) {
|
|
555
|
+
const resource = Resource_1.EResourceType.USER_SUBSCRIPTIONS;
|
|
556
|
+
// Fetching raw list of subscriptions
|
|
557
|
+
const response = await this.request(resource, {
|
|
558
|
+
id: id,
|
|
559
|
+
count: count,
|
|
560
|
+
cursor: cursor,
|
|
733
561
|
});
|
|
734
|
-
|
|
562
|
+
// Deserializing response
|
|
563
|
+
const data = Extractors_1.extractors[resource](response);
|
|
564
|
+
return data;
|
|
565
|
+
}
|
|
735
566
|
/**
|
|
736
567
|
* Get the tweet timeline of a user.
|
|
737
568
|
*
|
|
@@ -762,26 +593,18 @@ var UserService = /** @class */ (function (_super) {
|
|
|
762
593
|
* - If the target user has a pinned tweet, the returned timeline has one item extra and this is always the pinned tweet.
|
|
763
594
|
* - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
|
|
764
595
|
*/
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
return [4 /*yield*/, this.request(resource, {
|
|
773
|
-
id: id,
|
|
774
|
-
count: count,
|
|
775
|
-
cursor: cursor,
|
|
776
|
-
})];
|
|
777
|
-
case 1:
|
|
778
|
-
response = _a.sent();
|
|
779
|
-
data = Extractors_1.extractors[resource](response);
|
|
780
|
-
return [2 /*return*/, data];
|
|
781
|
-
}
|
|
782
|
-
});
|
|
596
|
+
async timeline(id, count, cursor) {
|
|
597
|
+
const resource = Resource_1.EResourceType.USER_TIMELINE;
|
|
598
|
+
// Fetching raw list of tweets
|
|
599
|
+
const response = await this.request(resource, {
|
|
600
|
+
id: id,
|
|
601
|
+
count: count,
|
|
602
|
+
cursor: cursor,
|
|
783
603
|
});
|
|
784
|
-
|
|
604
|
+
// Deserializing response
|
|
605
|
+
const data = Extractors_1.extractors[resource](response);
|
|
606
|
+
return data;
|
|
607
|
+
}
|
|
785
608
|
/**
|
|
786
609
|
* Unfollow a user.
|
|
787
610
|
*
|
|
@@ -808,24 +631,14 @@ var UserService = /** @class */ (function (_super) {
|
|
|
808
631
|
* });
|
|
809
632
|
* ```
|
|
810
633
|
*/
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
case 1:
|
|
821
|
-
response = _b.sent();
|
|
822
|
-
data = (_a = Extractors_1.extractors[resource](response)) !== null && _a !== void 0 ? _a : false;
|
|
823
|
-
return [2 /*return*/, data];
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
});
|
|
827
|
-
};
|
|
828
|
-
return UserService;
|
|
829
|
-
}(FetcherService_1.FetcherService));
|
|
634
|
+
async unfollow(id) {
|
|
635
|
+
const resource = Resource_1.EResourceType.USER_UNFOLLOW;
|
|
636
|
+
// Unfollowing the user
|
|
637
|
+
const response = await this.request(Resource_1.EResourceType.USER_UNFOLLOW, { id: id });
|
|
638
|
+
// Deserializing the response
|
|
639
|
+
const data = Extractors_1.extractors[resource](response) ?? false;
|
|
640
|
+
return data;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
830
643
|
exports.UserService = UserService;
|
|
831
644
|
//# sourceMappingURL=UserService.js.map
|