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
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthCredential = void 0;
|
|
4
|
+
const axios_1 = require("axios");
|
|
5
|
+
const Authentication_1 = require("../../enums/Authentication");
|
|
6
|
+
const AuthCookie_1 = require("./AuthCookie");
|
|
7
|
+
/**
|
|
8
|
+
* The credentials for authenticating against Twitter.
|
|
9
|
+
*
|
|
10
|
+
* Depending on which tokens are present, the authentication type is determined as follows:
|
|
11
|
+
* - authToken, guestToken =\> Guest authentication.
|
|
12
|
+
* - authToken, csrfToken, cookie =\> User authentication.
|
|
13
|
+
* - authToken, guestToken, cookie =\> Guest authentication while logging in.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class AuthCredential {
|
|
18
|
+
authToken;
|
|
19
|
+
authenticationType;
|
|
20
|
+
cookies;
|
|
21
|
+
csrfToken;
|
|
22
|
+
guestToken;
|
|
23
|
+
/**
|
|
24
|
+
* @param cookies - The list of cookies to be used for authenticating against Twitter.
|
|
25
|
+
* @param guestToken - The guest token to be used to authenticate a guest session.
|
|
26
|
+
*/
|
|
27
|
+
constructor(cookies, guestToken) {
|
|
28
|
+
this.authToken =
|
|
29
|
+
'AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA';
|
|
30
|
+
// If guest credentials given
|
|
31
|
+
if (!cookies && guestToken) {
|
|
32
|
+
this.guestToken = guestToken;
|
|
33
|
+
this.authenticationType = Authentication_1.EAuthenticationType.GUEST;
|
|
34
|
+
}
|
|
35
|
+
// If login credentials given
|
|
36
|
+
else if (cookies && guestToken) {
|
|
37
|
+
// Parsing the cookies
|
|
38
|
+
const parsedCookie = new AuthCookie_1.AuthCookie(cookies);
|
|
39
|
+
this.cookies = parsedCookie.toString();
|
|
40
|
+
this.guestToken = guestToken;
|
|
41
|
+
this.authenticationType = Authentication_1.EAuthenticationType.LOGIN;
|
|
42
|
+
}
|
|
43
|
+
// If user credentials given
|
|
44
|
+
else if (cookies && !guestToken) {
|
|
45
|
+
// Parsing the cookies
|
|
46
|
+
const parsedCookie = new AuthCookie_1.AuthCookie(cookies);
|
|
47
|
+
this.cookies = parsedCookie.toString();
|
|
48
|
+
this.csrfToken = parsedCookie.ct0;
|
|
49
|
+
this.authenticationType = Authentication_1.EAuthenticationType.USER;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @returns The HTTP header representation of 'this' object.
|
|
54
|
+
*/
|
|
55
|
+
toHeader() {
|
|
56
|
+
const headers = new axios_1.AxiosHeaders();
|
|
57
|
+
/**
|
|
58
|
+
* Conditionally initializing only those data which are supplied.
|
|
59
|
+
*
|
|
60
|
+
* This is done to ensure that the data that is not supplied, is not included in output, not even undefined.
|
|
61
|
+
*/
|
|
62
|
+
if (this.authToken) {
|
|
63
|
+
headers.set('authorization', `Bearer ${this.authToken}`);
|
|
64
|
+
}
|
|
65
|
+
if (this.guestToken) {
|
|
66
|
+
headers.set('x-guest-token', this.guestToken);
|
|
67
|
+
}
|
|
68
|
+
if (this.csrfToken) {
|
|
69
|
+
headers.set('x-csrf-token', this.csrfToken);
|
|
70
|
+
}
|
|
71
|
+
if (this.cookies) {
|
|
72
|
+
headers.set('cookie', this.cookies);
|
|
73
|
+
}
|
|
74
|
+
return headers;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.AuthCredential = AuthCredential;
|
|
78
|
+
//# sourceMappingURL=AuthCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthCredential.js","sourceRoot":"","sources":["../../../src/models/auth/AuthCredential.ts"],"names":[],"mappings":";;;AAAA,iCAA0D;AAI1D,+DAAiE;AAGjE,6CAA0C;AAE1C;;;;;;;;;GASG;AACH,MAAa,cAAc;IACnB,SAAS,CAAU;IACnB,kBAAkB,CAAuB;IACzC,OAAO,CAAU;IACjB,SAAS,CAAU;IACnB,UAAU,CAAU;IAE3B;;;OAGG;IACH,YAAmB,OAAkB,EAAE,UAAmB;QACzD,IAAI,CAAC,SAAS;YACb,0GAA0G,CAAC;QAC5G,6BAA6B;QAC7B,IAAI,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;YAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7B,IAAI,CAAC,kBAAkB,GAAG,oCAAmB,CAAC,KAAK,CAAC;QACrD,CAAC;QACD,6BAA6B;aACxB,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;YAChC,sBAAsB;YACtB,MAAM,YAAY,GAAe,IAAI,uBAAU,CAAC,OAAO,CAAC,CAAC;YAEzD,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;YACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7B,IAAI,CAAC,kBAAkB,GAAG,oCAAmB,CAAC,KAAK,CAAC;QACrD,CAAC;QACD,4BAA4B;aACvB,IAAI,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;YACjC,sBAAsB;YACtB,MAAM,YAAY,GAAe,IAAI,uBAAU,CAAC,OAAO,CAAC,CAAC;YAEzD,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;YACvC,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;YAClC,IAAI,CAAC,kBAAkB,GAAG,oCAAmB,CAAC,IAAI,CAAC;QACpD,CAAC;IACF,CAAC;IAED;;OAEG;IACI,QAAQ;QACd,MAAM,OAAO,GAAG,IAAI,oBAAY,EAAE,CAAC;QAEnC;;;;WAIG;QACH,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAjED,wCAiEC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EBaseType } from '../../enums/Data';
|
|
2
|
+
import { ICursoredData } from '../../types/data/CursoredData';
|
|
2
3
|
import { Notification } from './Notification';
|
|
3
4
|
import { Tweet } from './Tweet';
|
|
4
5
|
import { User } from './User';
|
|
@@ -9,27 +10,16 @@ import { User } from './User';
|
|
|
9
10
|
*
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
|
-
export declare class CursoredData<T extends Notification | Tweet | User> {
|
|
13
|
-
/** The batch of data of the given type. */
|
|
13
|
+
export declare class CursoredData<T extends Notification | Tweet | User> implements ICursoredData<T> {
|
|
14
14
|
list: T[];
|
|
15
|
-
|
|
16
|
-
next: Cursor;
|
|
15
|
+
next: string;
|
|
17
16
|
/**
|
|
18
17
|
* @param response - The raw response.
|
|
19
18
|
* @param type - The base type of the data included in the batch.
|
|
20
19
|
*/
|
|
21
20
|
constructor(response: NonNullable<unknown>, type: EBaseType);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The cursor to the batch of data to fetch.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
export declare class Cursor {
|
|
29
|
-
/** The cursor string. */
|
|
30
|
-
value: string;
|
|
31
21
|
/**
|
|
32
|
-
* @
|
|
22
|
+
* @returns A serializable JSON representation of `this` object.
|
|
33
23
|
*/
|
|
34
|
-
|
|
24
|
+
toJSON(): ICursoredData<T>;
|
|
35
25
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
exports.CursoredData = void 0;
|
|
4
|
+
const Data_1 = require("../../enums/Data");
|
|
5
|
+
const JsonUtils_1 = require("../../helper/JsonUtils");
|
|
6
|
+
const Notification_1 = require("./Notification");
|
|
7
|
+
const Tweet_1 = require("./Tweet");
|
|
8
|
+
const User_1 = require("./User");
|
|
9
9
|
/**
|
|
10
10
|
* The data that is fetched batch-wise using a cursor.
|
|
11
11
|
*
|
|
@@ -13,46 +13,39 @@ var User_1 = require("./User");
|
|
|
13
13
|
*
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
class CursoredData {
|
|
17
|
+
list;
|
|
18
|
+
next;
|
|
17
19
|
/**
|
|
18
20
|
* @param response - The raw response.
|
|
19
21
|
* @param type - The base type of the data included in the batch.
|
|
20
22
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/** The batch of data of the given type. */
|
|
23
|
+
constructor(response, type) {
|
|
24
|
+
// Initializing defaults
|
|
24
25
|
this.list = [];
|
|
25
|
-
|
|
26
|
-
this.next = new Cursor('');
|
|
26
|
+
this.next = '';
|
|
27
27
|
if (type == Data_1.EBaseType.TWEET) {
|
|
28
|
-
this.list = Tweet_1.Tweet.
|
|
29
|
-
this.next =
|
|
28
|
+
this.list = Tweet_1.Tweet.timeline(response);
|
|
29
|
+
this.next = (0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Bottom')[0]?.value ?? '';
|
|
30
30
|
}
|
|
31
31
|
else if (type == Data_1.EBaseType.USER) {
|
|
32
|
-
this.list = User_1.User.
|
|
33
|
-
this.next =
|
|
32
|
+
this.list = User_1.User.timeline(response);
|
|
33
|
+
this.next = (0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Bottom')[0]?.value ?? '';
|
|
34
34
|
}
|
|
35
35
|
else if (type == Data_1.EBaseType.NOTIFICATION) {
|
|
36
36
|
this.list = Notification_1.Notification.list(response);
|
|
37
|
-
this.next =
|
|
37
|
+
this.next = (0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Top')[0]?.value ?? '';
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
return CursoredData;
|
|
41
|
-
}());
|
|
42
|
-
exports.CursoredData = CursoredData;
|
|
43
|
-
/**
|
|
44
|
-
* The cursor to the batch of data to fetch.
|
|
45
|
-
*
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
var Cursor = /** @class */ (function () {
|
|
49
40
|
/**
|
|
50
|
-
* @
|
|
41
|
+
* @returns A serializable JSON representation of `this` object.
|
|
51
42
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
toJSON() {
|
|
44
|
+
return {
|
|
45
|
+
list: this.list.map((item) => item.toJSON()),
|
|
46
|
+
next: this.next,
|
|
47
|
+
};
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
exports.Cursor = Cursor;
|
|
49
|
+
}
|
|
50
|
+
exports.CursoredData = CursoredData;
|
|
58
51
|
//# sourceMappingURL=CursoredData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursoredData.js","sourceRoot":"","sources":["../../../src/models/data/CursoredData.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CursoredData.js","sourceRoot":"","sources":["../../../src/models/data/CursoredData.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C,sDAAsD;AAKtD,iDAA8C;AAC9C,mCAAgC;AAChC,iCAA8B;AAE9B;;;;;;GAMG;AACH,MAAa,YAAY;IACjB,IAAI,CAAM;IACV,IAAI,CAAS;IAEpB;;;OAGG;IACH,YAAmB,QAA8B,EAAE,IAAe;QACjE,wBAAwB;QACxB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QAEf,IAAI,IAAI,IAAI,gBAAS,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,GAAG,aAAK,CAAC,QAAQ,CAAC,QAAQ,CAAQ,CAAC;YAC5C,IAAI,CAAC,IAAI,GAAG,IAAA,wBAAY,EAAa,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;QACxF,CAAC;aAAM,IAAI,IAAI,IAAI,gBAAS,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,GAAG,WAAI,CAAC,QAAQ,CAAC,QAAQ,CAAQ,CAAC;YAC3C,IAAI,CAAC,IAAI,GAAG,IAAA,wBAAY,EAAa,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;QACxF,CAAC;aAAM,IAAI,IAAI,IAAI,gBAAS,CAAC,YAAY,EAAE,CAAC;YAC3C,IAAI,CAAC,IAAI,GAAG,2BAAY,CAAC,IAAI,CAAC,QAAQ,CAAQ,CAAC;YAC/C,IAAI,CAAC,IAAI,GAAG,IAAA,wBAAY,EAAa,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;QACrF,CAAC;IACF,CAAC;IAED;;OAEG;IACI,MAAM;QACZ,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAO,CAAC;YACjD,IAAI,EAAE,IAAI,CAAC,IAAI;SACf,CAAC;IACH,CAAC;CACD;AAlCD,oCAkCC"}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import { IList
|
|
1
|
+
import { IList } from '../../types/data/List';
|
|
2
|
+
import { IList as IRawList } from '../../types/raw/base/List';
|
|
2
3
|
/**
|
|
3
4
|
* The details of a single Twitter List.
|
|
4
5
|
*
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
7
|
-
export declare class List {
|
|
8
|
-
/** The date and time of creation of the list, int UTC string format. */
|
|
8
|
+
export declare class List implements IList {
|
|
9
9
|
createdAt: string;
|
|
10
|
-
/** The rest id of the user who created the list. */
|
|
11
10
|
createdBy: string;
|
|
12
|
-
/** The list description. */
|
|
13
11
|
description?: string;
|
|
14
|
-
/** The rest id of the list. */
|
|
15
12
|
id: string;
|
|
16
|
-
/** The number of memeber of the list. */
|
|
17
13
|
memberCount: number;
|
|
18
|
-
/** The name of the list. */
|
|
19
14
|
name: string;
|
|
20
|
-
/** The number of subscribers of the list. */
|
|
21
15
|
subscriberCount: number;
|
|
22
16
|
/**
|
|
23
17
|
* @param list - The raw list details.
|
|
24
18
|
*/
|
|
25
19
|
constructor(list: IRawList);
|
|
20
|
+
/**
|
|
21
|
+
* @returns A serializable JSON representation of `this` object.
|
|
22
|
+
*/
|
|
23
|
+
toJSON(): IList;
|
|
26
24
|
}
|
package/dist/models/data/List.js
CHANGED
|
@@ -6,11 +6,18 @@ exports.List = void 0;
|
|
|
6
6
|
*
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
class List {
|
|
10
|
+
createdAt;
|
|
11
|
+
createdBy;
|
|
12
|
+
description;
|
|
13
|
+
id;
|
|
14
|
+
memberCount;
|
|
15
|
+
name;
|
|
16
|
+
subscriberCount;
|
|
10
17
|
/**
|
|
11
18
|
* @param list - The raw list details.
|
|
12
19
|
*/
|
|
13
|
-
|
|
20
|
+
constructor(list) {
|
|
14
21
|
this.id = list.id_str;
|
|
15
22
|
this.name = list.name;
|
|
16
23
|
this.createdAt = new Date(list.created_at).toISOString();
|
|
@@ -19,7 +26,20 @@ var List = /** @class */ (function () {
|
|
|
19
26
|
this.subscriberCount = list.subscriber_count;
|
|
20
27
|
this.createdBy = list.user_results.result.id;
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @returns A serializable JSON representation of `this` object.
|
|
31
|
+
*/
|
|
32
|
+
toJSON() {
|
|
33
|
+
return {
|
|
34
|
+
createdAt: this.createdAt,
|
|
35
|
+
createdBy: this.createdBy,
|
|
36
|
+
description: this.description,
|
|
37
|
+
id: this.id,
|
|
38
|
+
memberCount: this.memberCount,
|
|
39
|
+
name: this.name,
|
|
40
|
+
subscriberCount: this.subscriberCount,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
24
44
|
exports.List = List;
|
|
25
45
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/models/data/List.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/models/data/List.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,MAAa,IAAI;IACT,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,WAAW,CAAU;IACrB,EAAE,CAAS;IACX,WAAW,CAAS;IACpB,IAAI,CAAS;IACb,eAAe,CAAS;IAE/B;;OAEG;IACH,YAAmB,IAAc;QAChC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,MAAM;QACZ,OAAO;YACN,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,eAAe,EAAE,IAAI,CAAC,eAAe;SACrC,CAAC;IACH,CAAC;CACD;AApCD,oBAoCC"}
|
|
@@ -1,46 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare enum ENotificationType {
|
|
8
|
-
RECOMMENDATION = "RECOMMENDATION",
|
|
9
|
-
INFORMATION = "INFORMATION",
|
|
10
|
-
LIVE = "LIVE",
|
|
11
|
-
ALERT = "ALERT",
|
|
12
|
-
UNDEFINED = "UNDEFINED"
|
|
13
|
-
}
|
|
1
|
+
import { ENotificationType } from '../../enums/Notification';
|
|
2
|
+
import { INotification } from '../../types/data/Notification';
|
|
3
|
+
import { INotification as IRawNotification } from '../../types/raw/base/Notification';
|
|
14
4
|
/**
|
|
15
5
|
* The details of a single notification.
|
|
16
6
|
*
|
|
17
7
|
* @public
|
|
18
8
|
*/
|
|
19
|
-
export declare class Notification {
|
|
20
|
-
/** The list of id of the users from whom the notification was received. */
|
|
9
|
+
export declare class Notification implements INotification {
|
|
21
10
|
from: string[];
|
|
22
|
-
/** The id of the notification. */
|
|
23
11
|
id: string;
|
|
24
|
-
/** The text contents of the notification. */
|
|
25
12
|
message: string;
|
|
26
|
-
|
|
27
|
-
receivedAt: Date;
|
|
28
|
-
/** The list of id of the target tweet(s) of the notification. */
|
|
13
|
+
receivedAt: string;
|
|
29
14
|
target: string[];
|
|
30
|
-
/** The type of notification. */
|
|
31
15
|
type?: ENotificationType;
|
|
32
16
|
/**
|
|
33
17
|
* @param notification - The raw notification details.
|
|
34
18
|
*/
|
|
35
|
-
constructor(notification:
|
|
19
|
+
constructor(notification: IRawNotification);
|
|
36
20
|
/**
|
|
37
21
|
* Extracts and deserializes the list of notifications from the given raw response data.
|
|
38
22
|
*
|
|
39
23
|
* @param response - The raw response data.
|
|
40
24
|
*
|
|
41
25
|
* @returns The deserialized list of notifications.
|
|
42
|
-
*
|
|
43
|
-
* @internal
|
|
44
26
|
*/
|
|
45
27
|
static list(response: NonNullable<unknown>): Notification[];
|
|
28
|
+
/**
|
|
29
|
+
* @returns A serializable JSON representation of `this` object.
|
|
30
|
+
*/
|
|
31
|
+
toJSON(): INotification;
|
|
46
32
|
}
|
|
@@ -1,46 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Notification =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* The different types of notifications.
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
var ENotificationType;
|
|
12
|
-
(function (ENotificationType) {
|
|
13
|
-
ENotificationType["RECOMMENDATION"] = "RECOMMENDATION";
|
|
14
|
-
ENotificationType["INFORMATION"] = "INFORMATION";
|
|
15
|
-
ENotificationType["LIVE"] = "LIVE";
|
|
16
|
-
ENotificationType["ALERT"] = "ALERT";
|
|
17
|
-
ENotificationType["UNDEFINED"] = "UNDEFINED";
|
|
18
|
-
})(ENotificationType || (exports.ENotificationType = ENotificationType = {}));
|
|
3
|
+
exports.Notification = void 0;
|
|
4
|
+
const Notification_1 = require("../../enums/Notification");
|
|
5
|
+
const Notification_2 = require("../../enums/raw/Notification");
|
|
6
|
+
const JsonUtils_1 = require("../../helper/JsonUtils");
|
|
19
7
|
/**
|
|
20
8
|
* The details of a single notification.
|
|
21
9
|
*
|
|
22
10
|
* @public
|
|
23
11
|
*/
|
|
24
|
-
|
|
12
|
+
class Notification {
|
|
13
|
+
from;
|
|
14
|
+
id;
|
|
15
|
+
message;
|
|
16
|
+
receivedAt;
|
|
17
|
+
target;
|
|
18
|
+
type;
|
|
25
19
|
/**
|
|
26
20
|
* @param notification - The raw notification details.
|
|
27
21
|
*/
|
|
28
|
-
|
|
29
|
-
var _a, _b, _c, _d;
|
|
22
|
+
constructor(notification) {
|
|
30
23
|
// Getting the original notification type
|
|
31
|
-
|
|
32
|
-
this.from =
|
|
33
|
-
? notification.template.aggregateUserActionsV1.fromUsers.map(
|
|
24
|
+
const notificationType = (0, JsonUtils_1.findKeyByValue)(Notification_2.ERawNotificationType, notification.icon.id);
|
|
25
|
+
this.from = notification.template?.aggregateUserActionsV1?.fromUsers
|
|
26
|
+
? notification.template.aggregateUserActionsV1.fromUsers.map((item) => item.user.id)
|
|
34
27
|
: [];
|
|
35
28
|
this.id = notification.id;
|
|
36
29
|
this.message = notification.message.text;
|
|
37
|
-
this.receivedAt = new Date(Number(notification.timestampMs));
|
|
38
|
-
this.target =
|
|
39
|
-
? notification.template.aggregateUserActionsV1.targetObjects.map(
|
|
30
|
+
this.receivedAt = new Date(Number(notification.timestampMs)).toISOString();
|
|
31
|
+
this.target = notification.template?.aggregateUserActionsV1?.targetObjects
|
|
32
|
+
? notification.template.aggregateUserActionsV1.targetObjects.map((item) => item.tweet.id)
|
|
40
33
|
: [];
|
|
41
34
|
this.type = notificationType
|
|
42
|
-
? ENotificationType[notificationType]
|
|
43
|
-
: ENotificationType.UNDEFINED;
|
|
35
|
+
? Notification_1.ENotificationType[notificationType]
|
|
36
|
+
: Notification_1.ENotificationType.UNDEFINED;
|
|
44
37
|
}
|
|
45
38
|
/**
|
|
46
39
|
* Extracts and deserializes the list of notifications from the given raw response data.
|
|
@@ -48,22 +41,31 @@ var Notification = /** @class */ (function () {
|
|
|
48
41
|
* @param response - The raw response data.
|
|
49
42
|
*
|
|
50
43
|
* @returns The deserialized list of notifications.
|
|
51
|
-
*
|
|
52
|
-
* @internal
|
|
53
44
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
static list(response) {
|
|
46
|
+
const notifications = [];
|
|
56
47
|
// Extracting notifications
|
|
57
48
|
if (response.globalObjects.notifications) {
|
|
58
49
|
// Iterating over the raw list of notifications
|
|
59
|
-
for (
|
|
60
|
-
var _b = _a[_i], value = _b[1];
|
|
50
|
+
for (const [, value] of Object.entries(response.globalObjects.notifications)) {
|
|
61
51
|
notifications.push(new Notification(value));
|
|
62
52
|
}
|
|
63
53
|
}
|
|
64
54
|
return notifications;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @returns A serializable JSON representation of `this` object.
|
|
58
|
+
*/
|
|
59
|
+
toJSON() {
|
|
60
|
+
return {
|
|
61
|
+
from: this.from,
|
|
62
|
+
id: this.id,
|
|
63
|
+
message: this.message,
|
|
64
|
+
receivedAt: this.receivedAt,
|
|
65
|
+
target: this.target,
|
|
66
|
+
type: this.type,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
68
70
|
exports.Notification = Notification;
|
|
69
71
|
//# sourceMappingURL=Notification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../src/models/data/Notification.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../src/models/data/Notification.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAC7D,+DAAoE;AACpE,sDAAwD;AAKxD;;;;GAIG;AACH,MAAa,YAAY;IACjB,IAAI,CAAW;IACf,EAAE,CAAS;IACX,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,MAAM,CAAW;IACjB,IAAI,CAAqB;IAEhC;;OAEG;IACH,YAAmB,YAA8B;QAChD,yCAAyC;QACzC,MAAM,gBAAgB,GAAuB,IAAA,0BAAc,EAAC,mCAAoB,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAExG,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,QAAQ,EAAE,sBAAsB,EAAE,SAAS;YACnE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACpF,CAAC,CAAC,EAAE,CAAC;QACN,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3E,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,sBAAsB,EAAE,aAAa;YACzE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACzF,CAAC,CAAC,EAAE,CAAC;QACN,IAAI,CAAC,IAAI,GAAG,gBAAgB;YAC3B,CAAC,CAAC,gCAAiB,CAAC,gBAAkD,CAAC;YACvE,CAAC,CAAC,gCAAiB,CAAC,SAAS,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,IAAI,CAAC,QAA8B;QAChD,MAAM,aAAa,GAAmB,EAAE,CAAC;QAEzC,2BAA2B;QAC3B,IAAK,QAAuC,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;YAC1E,+CAA+C;YAC/C,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CACpC,QAAuC,CAAC,aAAa,CAAC,aAAa,CACpE,EAAE,CAAC;gBACH,aAAa,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,KAAyB,CAAC,CAAC,CAAC;YACjE,CAAC;QACF,CAAC;QAED,OAAO,aAAa,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,MAAM;QACZ,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;SACf,CAAC;IACH,CAAC;CACD;AAjED,oCAiEC"}
|
|
@@ -1,54 +1,40 @@
|
|
|
1
|
-
import { EMediaType
|
|
1
|
+
import { EMediaType } from '../../enums/Media';
|
|
2
|
+
import { ITweet, ITweetEntities, ITweetMedia } from '../../types/data/Tweet';
|
|
3
|
+
import { IExtendedMedia as IRawExtendedMedia } from '../../types/raw/base/Media';
|
|
4
|
+
import { ITweet as IRawTweet, IEntities as IRawTweetEntities } from '../../types/raw/base/Tweet';
|
|
2
5
|
import { User } from './User';
|
|
3
6
|
/**
|
|
4
7
|
* The details of a single tweet.
|
|
5
8
|
*
|
|
6
9
|
* @public
|
|
7
10
|
*/
|
|
8
|
-
export declare class Tweet {
|
|
9
|
-
/** The number of bookmarks of a tweet. */
|
|
11
|
+
export declare class Tweet implements ITweet {
|
|
10
12
|
bookmarkCount: number;
|
|
11
|
-
|
|
13
|
+
conversationId: string;
|
|
12
14
|
createdAt: string;
|
|
13
|
-
/** Additional tweet entities like urls, mentions, etc. */
|
|
14
15
|
entities: TweetEntities;
|
|
15
|
-
/** The full text content of the tweet. */
|
|
16
16
|
fullText: string;
|
|
17
|
-
/** The rest id of the tweet. */
|
|
18
17
|
id: string;
|
|
19
|
-
/** The language in which the tweet is written. */
|
|
20
18
|
lang: string;
|
|
21
|
-
/** The number of likes of the tweet. */
|
|
22
19
|
likeCount: number;
|
|
23
|
-
/** The urls of the media contents of the tweet (if any). */
|
|
24
20
|
media?: TweetMedia[];
|
|
25
|
-
/** The number of quotes of the tweet. */
|
|
26
21
|
quoteCount: number;
|
|
27
|
-
/** The tweet which is quoted in the tweet. */
|
|
28
22
|
quoted?: Tweet;
|
|
29
|
-
/** The number of replies to the tweet. */
|
|
30
23
|
replyCount: number;
|
|
31
|
-
|
|
32
|
-
replyTo?: Tweet;
|
|
33
|
-
/** The number of retweets of the tweet. */
|
|
24
|
+
replyTo?: string;
|
|
34
25
|
retweetCount: number;
|
|
35
|
-
/** The tweet which is retweeted in this tweet (if any). */
|
|
36
26
|
retweetedTweet?: Tweet;
|
|
37
|
-
/** The details of the user who made the tweet. */
|
|
38
27
|
tweetBy: User;
|
|
39
|
-
|
|
28
|
+
url: string;
|
|
40
29
|
viewCount: number;
|
|
41
30
|
/**
|
|
42
31
|
* @param tweet - The raw tweet details.
|
|
43
|
-
* @param response - The raw response
|
|
44
32
|
*/
|
|
45
|
-
constructor(tweet: IRawTweet
|
|
46
|
-
private getParentTweet;
|
|
33
|
+
constructor(tweet: IRawTweet);
|
|
47
34
|
/**
|
|
48
35
|
* Extract and deserialize the original quoted tweet from the given raw tweet.
|
|
49
36
|
*
|
|
50
37
|
* @param tweet - The raw tweet.
|
|
51
|
-
* @param response - The raw response
|
|
52
38
|
*
|
|
53
39
|
* @returns - The deserialized original quoted tweet.
|
|
54
40
|
*/
|
|
@@ -57,21 +43,19 @@ export declare class Tweet {
|
|
|
57
43
|
* Extract and deserialize the original retweeted tweet from the given raw tweet.
|
|
58
44
|
*
|
|
59
45
|
* @param tweet - The raw tweet.
|
|
60
|
-
* @param response - The raw response
|
|
61
46
|
*
|
|
62
47
|
* @returns - The deserialized original retweeted tweet.
|
|
63
48
|
*/
|
|
64
49
|
private getRetweetedTweet;
|
|
65
50
|
/**
|
|
66
|
-
* Extracts and deserializes
|
|
51
|
+
* Extracts and deserializes multiple target tweets from the given raw response data.
|
|
67
52
|
*
|
|
68
53
|
* @param response - The raw response data.
|
|
54
|
+
* @param ids - The ids of the target tweets.
|
|
69
55
|
*
|
|
70
|
-
* @returns The deserialized
|
|
71
|
-
*
|
|
72
|
-
* @internal
|
|
56
|
+
* @returns The target deserialized tweets.
|
|
73
57
|
*/
|
|
74
|
-
static
|
|
58
|
+
static multiple(response: NonNullable<unknown>, ids: string[]): Tweet[];
|
|
75
59
|
/**
|
|
76
60
|
* Extracts and deserializes a single target tweet from the given raw response data.
|
|
77
61
|
*
|
|
@@ -79,10 +63,21 @@ export declare class Tweet {
|
|
|
79
63
|
* @param id - The id of the target tweet.
|
|
80
64
|
*
|
|
81
65
|
* @returns The target deserialized tweet.
|
|
82
|
-
*
|
|
83
|
-
* @internal
|
|
84
66
|
*/
|
|
85
67
|
static single(response: NonNullable<unknown>, id: string): Tweet | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Extracts and deserializes the timeline of tweets from the given raw response data.
|
|
70
|
+
*
|
|
71
|
+
* @param response - The raw response data.
|
|
72
|
+
* @param ids - The IDs of specific tweets that need to be extracted.
|
|
73
|
+
*
|
|
74
|
+
* @returns The deserialized timeline of tweets.
|
|
75
|
+
*/
|
|
76
|
+
static timeline(response: NonNullable<unknown>): Tweet[];
|
|
77
|
+
/**
|
|
78
|
+
* @returns A serializable JSON representation of `this` object.
|
|
79
|
+
*/
|
|
80
|
+
toJSON(): ITweet;
|
|
86
81
|
}
|
|
87
82
|
/**
|
|
88
83
|
* The different types parsed entities like urls, media, mentions, hashtags, etc.
|
|
@@ -100,6 +95,10 @@ export declare class TweetEntities {
|
|
|
100
95
|
* @param entities - The raw tweet entities.
|
|
101
96
|
*/
|
|
102
97
|
constructor(entities: IRawTweetEntities);
|
|
98
|
+
/**
|
|
99
|
+
* @returns A serializable JSON representation of `this` object.
|
|
100
|
+
*/
|
|
101
|
+
toJSON(): ITweetEntities;
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
105
104
|
* The details of a single media content included in a tweet.
|
|
@@ -117,4 +116,8 @@ export declare class TweetMedia {
|
|
|
117
116
|
* @param media - The raw media details.
|
|
118
117
|
*/
|
|
119
118
|
constructor(media: IRawExtendedMedia);
|
|
119
|
+
/**
|
|
120
|
+
* @returns A serializable JSON representation of `this` object.
|
|
121
|
+
*/
|
|
122
|
+
toJSON(): ITweetMedia;
|
|
120
123
|
}
|