rettiwt-api 1.1.7 → 1.2.0
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/.github/workflows/build-docs.yml +22 -21
- package/.github/workflows/publish-to-npm.yml +29 -0
- package/README.md +52 -40
- package/dist/config/env.d.ts +5 -5
- package/dist/config/env.js +8 -8
- package/dist/enums/Errors.d.ts +20 -20
- package/dist/enums/Errors.js +27 -27
- package/dist/enums/HTTP.d.ts +17 -17
- package/dist/enums/HTTP.js +22 -22
- package/dist/graphql/enums/Errors.d.ts +21 -21
- package/dist/graphql/enums/Errors.js +28 -28
- package/dist/graphql/queries/RootQuery.d.ts +4 -4
- package/dist/graphql/queries/RootQuery.js +77 -77
- package/dist/graphql/resolvers/AccountResolver.d.ts +12 -12
- package/dist/graphql/resolvers/AccountResolver.js +83 -83
- package/dist/graphql/resolvers/ResolverBase.d.ts +16 -16
- package/dist/graphql/resolvers/ResolverBase.js +22 -22
- package/dist/graphql/resolvers/TweetResolver.d.ts +46 -46
- package/dist/graphql/resolvers/TweetResolver.js +311 -311
- package/dist/graphql/resolvers/UserResolver.d.ts +48 -48
- package/dist/graphql/resolvers/UserResolver.js +333 -333
- package/dist/graphql/resolvers/UserResolver.js.map +1 -1
- package/dist/graphql/types/Global.d.ts +4 -4
- package/dist/graphql/types/Global.js +12 -12
- package/dist/graphql/types/TweetTypes.d.ts +4 -4
- package/dist/graphql/types/TweetTypes.js +159 -159
- package/dist/graphql/types/UserTypes.d.ts +3 -3
- package/dist/graphql/types/UserTypes.js +136 -136
- package/dist/graphql/types/UserTypes.js.map +1 -1
- package/dist/index.d.ts +43 -43
- package/dist/index.js +70 -70
- package/dist/models/args/TweetFilter.d.ts +65 -59
- package/dist/models/args/TweetFilter.js +120 -100
- package/dist/models/args/TweetFilter.js.map +1 -1
- package/dist/models/args/TweetListArgs.d.ts +21 -21
- package/dist/models/args/TweetListArgs.js +53 -53
- package/dist/models/args/UserListArgs.d.ts +21 -21
- package/dist/models/args/UserListArgs.js +53 -53
- package/dist/models/auth/AuthCookie.d.ts +21 -21
- package/dist/models/auth/AuthCookie.js +32 -32
- package/dist/models/data/CursoredData.d.ts +34 -34
- package/dist/models/data/CursoredData.js +41 -41
- package/dist/models/data/Tweet.d.ts +53 -53
- package/dist/models/data/Tweet.js +103 -103
- package/dist/models/data/User.d.ts +41 -41
- package/dist/models/data/User.js +31 -31
- package/dist/models/errors/DataValidationError.d.ts +20 -20
- package/dist/models/errors/DataValidationError.js +22 -22
- package/dist/server.d.ts +1 -1
- package/dist/server.js +75 -75
- package/dist/services/auth/AccountService.d.ts +83 -88
- package/dist/services/auth/AccountService.js +411 -391
- package/dist/services/auth/AccountService.js.map +1 -1
- package/dist/services/auth/AuthService.d.ts +31 -31
- package/dist/services/auth/AuthService.js +117 -117
- package/dist/services/data/TweetService.d.ts +60 -74
- package/dist/services/data/TweetService.js +251 -254
- package/dist/services/data/TweetService.js.map +1 -1
- package/dist/services/data/UserService.d.ts +71 -87
- package/dist/services/data/UserService.js +287 -296
- package/dist/services/data/UserService.js.map +1 -1
- package/dist/services/helper/Headers.d.ts +19 -19
- package/dist/services/helper/Headers.js +61 -61
- package/dist/services/helper/Parser.d.ts +22 -28
- package/dist/services/helper/Parser.js +83 -104
- package/dist/services/helper/Parser.js.map +1 -1
- package/dist/services/helper/extractors/Tweets.d.ts +32 -32
- package/dist/services/helper/extractors/Tweets.js +263 -263
- package/dist/services/helper/extractors/Users.d.ts +26 -26
- package/dist/services/helper/extractors/Users.js +202 -202
- package/dist/services/helper/payloads/LoginFlows.d.ts +77 -77
- package/dist/services/helper/payloads/LoginFlows.js +91 -91
- package/dist/services/helper/urls/Authentication.d.ts +4 -4
- package/dist/services/helper/urls/Authentication.js +10 -10
- package/dist/services/util/CacheService.d.ts +33 -33
- package/dist/services/util/CacheService.js +95 -95
- package/dist/services/util/FetcherService.d.ts +65 -65
- package/dist/services/util/FetcherService.js +213 -213
- package/dist/twitter/Url.d.ts +22 -0
- package/dist/twitter/Url.js +32 -0
- package/dist/twitter/Url.js.map +1 -0
- package/dist/twitter/enums/Resources.d.ts +15 -0
- package/dist/twitter/enums/Resources.js +21 -0
- package/dist/twitter/enums/Resources.js.map +1 -0
- package/dist/twitter/params/Query.d.ts +67 -0
- package/dist/twitter/params/Query.js +64 -0
- package/dist/twitter/params/Query.js.map +1 -0
- package/dist/twitter/payloads/Args.d.ts +16 -0
- package/dist/twitter/payloads/Args.js +16 -0
- package/dist/twitter/payloads/Args.js.map +1 -0
- package/dist/{types/raw/query/tweet/Engagements.d.ts → twitter/payloads/Features.d.ts} +28 -29
- package/dist/twitter/payloads/Features.js +37 -0
- package/dist/twitter/payloads/Features.js.map +1 -0
- package/dist/twitter/payloads/Variables.d.ts +41 -0
- package/dist/twitter/payloads/Variables.js +64 -0
- package/dist/twitter/payloads/Variables.js.map +1 -0
- package/dist/{types → twitter/types/request}/Query.d.ts +86 -80
- package/dist/{types/data/Tweet.js → twitter/types/request/Query.js} +4 -4
- package/dist/twitter/types/request/Query.js.map +1 -0
- package/dist/{types/raw/data → twitter/types}/tweet/Favouriters.d.ts +164 -164
- package/dist/twitter/types/tweet/Favouriters.js +3 -0
- package/dist/twitter/types/tweet/Favouriters.js.map +1 -0
- package/dist/{types/raw → twitter/types}/tweet/Retweeters.d.ts +171 -171
- package/dist/{types/Trends.js → twitter/types/tweet/Retweeters.js} +3 -3
- package/dist/twitter/types/tweet/Retweeters.js.map +1 -0
- package/dist/{types/raw/data → twitter/types}/tweet/Tweet.d.ts +746 -746
- package/dist/{types/data/User.js → twitter/types/tweet/Tweet.js} +3 -3
- package/dist/twitter/types/tweet/Tweet.js.map +1 -0
- package/dist/{types/raw → twitter/types}/tweet/Tweets.d.ts +386 -386
- package/dist/{types/raw/user/User.js → twitter/types/tweet/Tweets.js} +3 -3
- package/dist/twitter/types/tweet/Tweets.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/Followers.d.ts +176 -176
- package/dist/{types/interfaces/Rettiwt.js → twitter/types/user/Followers.js} +3 -3
- package/dist/twitter/types/user/Followers.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/Following.d.ts +176 -176
- package/dist/{types/Query.js → twitter/types/user/Following.js} +3 -3
- package/dist/twitter/types/user/Following.js.map +1 -0
- package/dist/{types/raw/data → twitter/types}/user/Likes.d.ts +1059 -1059
- package/dist/{types/interfaces/User.js → twitter/types/user/Likes.js} +3 -3
- package/dist/twitter/types/user/Likes.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/Tweets.d.ts +1512 -1512
- package/dist/twitter/types/user/Tweets.js +3 -0
- package/dist/twitter/types/user/Tweets.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/User.d.ts +117 -117
- package/dist/{types/raw/data → twitter/types}/user/User.js +2 -2
- package/dist/{types/data → twitter/types/user}/User.js.map +1 -1
- package/dist/types/Args.d.ts +38 -38
- package/dist/types/Args.js +4 -4
- package/dist/types/Authentication.d.ts +55 -55
- package/dist/types/Authentication.js +5 -5
- package/dist/types/Resolvers.d.ts +15 -15
- package/dist/types/Resolvers.js +2 -2
- package/dist/types/Rettiwt.d.ts +16 -16
- package/dist/types/Rettiwt.js +2 -2
- package/dist/types/Service.d.ts +22 -22
- package/dist/types/Service.js +4 -4
- package/dist/types/Tweet.d.ts +46 -46
- package/dist/types/Tweet.js +2 -2
- package/dist/types/User.d.ts +35 -35
- package/dist/types/User.js +2 -2
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +64 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1280 -0
- package/docs/classes/AccountService.html +286 -0
- package/docs/classes/AuthCookie.html +146 -0
- package/docs/classes/AuthService.html +147 -0
- package/docs/classes/CacheService.html +157 -0
- package/docs/classes/Cursor.html +102 -0
- package/docs/classes/CursoredData.html +126 -0
- package/docs/classes/DataValidationError.html +119 -0
- package/docs/classes/FetcherService.html +225 -0
- package/docs/classes/Tweet.html +210 -0
- package/docs/classes/TweetEntities.html +128 -0
- package/docs/classes/TweetFilter.html +221 -0
- package/docs/classes/TweetListArgs.html +118 -0
- package/docs/classes/TweetService.html +319 -0
- package/docs/classes/User.html +230 -0
- package/docs/classes/UserListArgs.html +118 -0
- package/docs/classes/UserService.html +355 -0
- package/docs/enums/HttpMethods.html +74 -0
- package/docs/functions/Rettiwt.html +99 -0
- package/docs/index.html +158 -0
- package/docs/interfaces/IAuthCookie.html +104 -0
- package/docs/interfaces/ICursor.html +77 -0
- package/docs/interfaces/ICursoredData.html +93 -0
- package/docs/interfaces/IDataContext.html +91 -0
- package/docs/interfaces/IListArgs.html +87 -0
- package/docs/interfaces/ITweet.html +176 -0
- package/docs/interfaces/ITweetEntities.html +104 -0
- package/docs/interfaces/ITweetFilter.html +158 -0
- package/docs/interfaces/IUser.html +194 -0
- package/docs/modules.html +109 -0
- package/package.json +2 -2
- package/src/graphql/resolvers/UserResolver.ts +4 -4
- package/src/graphql/types/UserTypes.ts +1 -1
- package/src/models/args/TweetFilter.ts +25 -4
- package/src/models/data/Tweet.ts +1 -1
- package/src/models/data/User.ts +1 -1
- package/src/services/auth/AccountService.ts +79 -53
- package/src/services/data/TweetService.ts +35 -65
- package/src/services/data/UserService.ts +42 -48
- package/src/services/helper/Parser.ts +3 -24
- package/src/services/helper/extractors/Tweets.ts +4 -4
- package/src/services/helper/extractors/Users.ts +5 -5
- package/src/services/util/FetcherService.ts +4 -4
- package/src/twitter/Url.ts +37 -0
- package/src/twitter/enums/Resources.ts +15 -0
- package/src/twitter/params/Query.ts +100 -0
- package/src/twitter/payloads/Args.ts +21 -0
- package/src/twitter/payloads/Features.ts +33 -0
- package/src/twitter/payloads/Variables.ts +73 -0
- package/src/twitter/types/request/Query.ts +91 -0
- package/src/{types/raw → twitter/types}/user/Tweets.ts +1747 -1747
- package/src/types/Args.ts +1 -1
- package/dist/Test.d.ts +0 -0
- package/dist/Test.js +0 -2
- package/dist/Test.js.map +0 -1
- package/dist/endpoints/Endpoints.d.ts +0 -14
- package/dist/endpoints/Endpoints.js +0 -20
- package/dist/endpoints/Endpoints.js.map +0 -1
- package/dist/endpoints/Url.d.ts +0 -5
- package/dist/endpoints/Url.js +0 -12
- package/dist/endpoints/Url.js.map +0 -1
- package/dist/enums/Endpoints.d.ts +0 -25
- package/dist/enums/Endpoints.js +0 -31
- package/dist/enums/Endpoints.js.map +0 -1
- package/dist/graphql/types/Errors.d.ts +0 -20
- package/dist/graphql/types/Errors.js +0 -28
- package/dist/graphql/types/Errors.js.map +0 -1
- package/dist/middlewares/Authentication.d.ts +0 -0
- package/dist/middlewares/Authentication.js +0 -2
- package/dist/middlewares/Authentication.js.map +0 -1
- package/dist/models/data/DataValidationError.d.ts +0 -18
- package/dist/models/data/DataValidationError.js +0 -21
- package/dist/models/data/DataValidationError.js.map +0 -1
- package/dist/models/data/Errors.d.ts +0 -18
- package/dist/models/data/Errors.js +0 -21
- package/dist/models/data/Errors.js.map +0 -1
- package/dist/models/data/Service.d.ts +0 -33
- package/dist/models/data/Service.js +0 -41
- package/dist/models/data/Service.js.map +0 -1
- package/dist/models/graphql/Global.d.ts +0 -4
- package/dist/models/graphql/Global.js +0 -13
- package/dist/models/graphql/Global.js.map +0 -1
- package/dist/models/graphql/TweetTypes.d.ts +0 -6
- package/dist/models/graphql/TweetTypes.js +0 -156
- package/dist/models/graphql/TweetTypes.js.map +0 -1
- package/dist/models/graphql/UserTypes.d.ts +0 -3
- package/dist/models/graphql/UserTypes.js +0 -139
- package/dist/models/graphql/UserTypes.js.map +0 -1
- package/dist/models/query/Variables.d.ts +0 -2
- package/dist/models/query/Variables.js +0 -10
- package/dist/models/query/Variables.js.map +0 -1
- package/dist/queries/RootQuery.d.ts +0 -4
- package/dist/queries/RootQuery.js +0 -70
- package/dist/queries/RootQuery.js.map +0 -1
- package/dist/requests/Url.d.ts +0 -5
- package/dist/requests/Url.js +0 -12
- package/dist/requests/Url.js.map +0 -1
- package/dist/requests/payloads/Variables.d.ts +0 -23
- package/dist/requests/payloads/Variables.js +0 -24
- package/dist/requests/payloads/Variables.js.map +0 -1
- package/dist/resolvers/AccountResolver.d.ts +0 -12
- package/dist/resolvers/AccountResolver.js +0 -84
- package/dist/resolvers/AccountResolver.js.map +0 -1
- package/dist/resolvers/ResolverBase.d.ts +0 -5
- package/dist/resolvers/ResolverBase.js +0 -11
- package/dist/resolvers/ResolverBase.js.map +0 -1
- package/dist/resolvers/TweetResolver.d.ts +0 -54
- package/dist/resolvers/TweetResolver.js +0 -332
- package/dist/resolvers/TweetResolver.js.map +0 -1
- package/dist/resolvers/UserResolver.d.ts +0 -38
- package/dist/resolvers/UserResolver.js +0 -253
- package/dist/resolvers/UserResolver.js.map +0 -1
- package/dist/services/AuthService.d.ts +0 -22
- package/dist/services/AuthService.js +0 -106
- package/dist/services/AuthService.js.map +0 -1
- package/dist/services/CacheService.d.ts +0 -30
- package/dist/services/CacheService.js +0 -93
- package/dist/services/CacheService.js.map +0 -1
- package/dist/services/FetcherService.d.ts +0 -61
- package/dist/services/FetcherService.js +0 -209
- package/dist/services/FetcherService.js.map +0 -1
- package/dist/services/accounts/AccountService.d.ts +0 -65
- package/dist/services/accounts/AccountService.js +0 -336
- package/dist/services/accounts/AccountService.js.map +0 -1
- package/dist/services/accounts/LoginFlows.d.ts +0 -77
- package/dist/services/accounts/LoginFlows.js +0 -92
- package/dist/services/accounts/LoginFlows.js.map +0 -1
- package/dist/services/auth/LoginFlows.d.ts +0 -77
- package/dist/services/auth/LoginFlows.js +0 -92
- package/dist/services/auth/LoginFlows.js.map +0 -1
- package/dist/services/data/TrendService.d.ts +0 -17
- package/dist/services/data/TrendService.js +0 -116
- package/dist/services/data/TrendService.js.map +0 -1
- package/dist/services/data/UserAccountService.d.ts +0 -42
- package/dist/services/data/UserAccountService.js +0 -239
- package/dist/services/data/UserAccountService.js.map +0 -1
- package/dist/services/helper/Deserializers.d.ts +0 -19
- package/dist/services/helper/Deserializers.js +0 -115
- package/dist/services/helper/Deserializers.js.map +0 -1
- package/dist/services/helper/Extractors.d.ts +0 -104
- package/dist/services/helper/Extractors.js +0 -432
- package/dist/services/helper/Extractors.js.map +0 -1
- package/dist/services/helper/Urls.d.ts +0 -85
- package/dist/services/helper/Urls.js +0 -130
- package/dist/services/helper/Urls.js.map +0 -1
- package/dist/services/helper/deserializers/Tweets.d.ts +0 -12
- package/dist/services/helper/deserializers/Tweets.js +0 -92
- package/dist/services/helper/deserializers/Tweets.js.map +0 -1
- package/dist/services/helper/deserializers/Users.d.ts +0 -7
- package/dist/services/helper/deserializers/Users.js +0 -27
- package/dist/services/helper/deserializers/Users.js.map +0 -1
- package/dist/services/helper/extractors/Trends.d.ts +0 -3
- package/dist/services/helper/extractors/Trends.js +0 -51
- package/dist/services/helper/extractors/Trends.js.map +0 -1
- package/dist/services/helper/urls/Trends.d.ts +0 -7
- package/dist/services/helper/urls/Trends.js +0 -13
- package/dist/services/helper/urls/Trends.js.map +0 -1
- package/dist/services/helper/urls/Tweets.d.ts +0 -32
- package/dist/services/helper/urls/Tweets.js +0 -51
- package/dist/services/helper/urls/Tweets.js.map +0 -1
- package/dist/services/helper/urls/Users.d.ts +0 -38
- package/dist/services/helper/urls/Users.js +0 -76
- package/dist/services/helper/urls/Users.js.map +0 -1
- package/dist/types/HTTP.d.ts +0 -17
- package/dist/types/HTTP.js +0 -23
- package/dist/types/HTTP.js.map +0 -1
- package/dist/types/Query.js.map +0 -1
- package/dist/types/Trends.d.ts +0 -50
- package/dist/types/Trends.js.map +0 -1
- package/dist/types/UserAccount.d.ts +0 -19
- package/dist/types/UserAccount.js +0 -4
- package/dist/types/UserAccount.js.map +0 -1
- package/dist/types/args/TweetFilter.d.ts +0 -54
- package/dist/types/args/TweetFilter.js +0 -96
- package/dist/types/args/TweetFilter.js.map +0 -1
- package/dist/types/args/TweetListArg.d.ts +0 -10
- package/dist/types/args/TweetListArg.js +0 -42
- package/dist/types/args/TweetListArg.js.map +0 -1
- package/dist/types/args/TweetListArgs.d.ts +0 -20
- package/dist/types/args/TweetListArgs.js +0 -52
- package/dist/types/args/TweetListArgs.js.map +0 -1
- package/dist/types/args/UserListArgs.d.ts +0 -16
- package/dist/types/args/UserListArgs.js +0 -48
- package/dist/types/args/UserListArgs.js.map +0 -1
- package/dist/types/data/Errors.d.ts +0 -35
- package/dist/types/data/Errors.js +0 -45
- package/dist/types/data/Errors.js.map +0 -1
- package/dist/types/data/Service.d.ts +0 -43
- package/dist/types/data/Service.js +0 -22
- package/dist/types/data/Service.js.map +0 -1
- package/dist/types/data/Tweet.d.ts +0 -98
- package/dist/types/data/Tweet.js.map +0 -1
- package/dist/types/data/TweetFilter.d.ts +0 -49
- package/dist/types/data/TweetFilter.js +0 -63
- package/dist/types/data/TweetFilter.js.map +0 -1
- package/dist/types/data/User.d.ts +0 -38
- package/dist/types/graphql/Errors.d.ts +0 -15
- package/dist/types/graphql/Errors.js +0 -23
- package/dist/types/graphql/Errors.js.map +0 -1
- package/dist/types/interfaces/Args.d.ts +0 -38
- package/dist/types/interfaces/Args.js +0 -5
- package/dist/types/interfaces/Args.js.map +0 -1
- package/dist/types/interfaces/Authentication.d.ts +0 -40
- package/dist/types/interfaces/Authentication.js +0 -5
- package/dist/types/interfaces/Authentication.js.map +0 -1
- package/dist/types/interfaces/Resolvers.d.ts +0 -14
- package/dist/types/interfaces/Resolvers.js +0 -3
- package/dist/types/interfaces/Resolvers.js.map +0 -1
- package/dist/types/interfaces/Rettiwt.d.ts +0 -16
- package/dist/types/interfaces/Rettiwt.js.map +0 -1
- package/dist/types/interfaces/Service.d.ts +0 -13
- package/dist/types/interfaces/Service.js +0 -3
- package/dist/types/interfaces/Service.js.map +0 -1
- package/dist/types/interfaces/Services.d.ts +0 -13
- package/dist/types/interfaces/Services.js +0 -3
- package/dist/types/interfaces/Services.js.map +0 -1
- package/dist/types/interfaces/Tweet.d.ts +0 -46
- package/dist/types/interfaces/Tweet.js +0 -3
- package/dist/types/interfaces/Tweet.js.map +0 -1
- package/dist/types/interfaces/TweetFilter.d.ts +0 -0
- package/dist/types/interfaces/TweetFilter.js +0 -2
- package/dist/types/interfaces/TweetFilter.js.map +0 -1
- package/dist/types/interfaces/User.d.ts +0 -35
- package/dist/types/interfaces/User.js.map +0 -1
- package/dist/types/raw/auth/Cookie.d.ts +0 -16
- package/dist/types/raw/auth/Cookie.js +0 -3
- package/dist/types/raw/auth/Cookie.js.map +0 -1
- package/dist/types/raw/data/tweet/Favouriters.js +0 -3
- package/dist/types/raw/data/tweet/Favouriters.js.map +0 -1
- package/dist/types/raw/data/tweet/Retweeters.d.ts +0 -171
- package/dist/types/raw/data/tweet/Retweeters.js +0 -3
- package/dist/types/raw/data/tweet/Retweeters.js.map +0 -1
- package/dist/types/raw/data/tweet/Tweet.js +0 -3
- package/dist/types/raw/data/tweet/Tweet.js.map +0 -1
- package/dist/types/raw/data/tweet/Tweets.d.ts +0 -386
- package/dist/types/raw/data/tweet/Tweets.js +0 -3
- package/dist/types/raw/data/tweet/Tweets.js.map +0 -1
- package/dist/types/raw/data/user/Followers.d.ts +0 -176
- package/dist/types/raw/data/user/Followers.js +0 -3
- package/dist/types/raw/data/user/Followers.js.map +0 -1
- package/dist/types/raw/data/user/Following.d.ts +0 -176
- package/dist/types/raw/data/user/Following.js +0 -3
- package/dist/types/raw/data/user/Following.js.map +0 -1
- package/dist/types/raw/data/user/Likes.js +0 -3
- package/dist/types/raw/data/user/Likes.js.map +0 -1
- package/dist/types/raw/data/user/User.d.ts +0 -117
- package/dist/types/raw/data/user/User.js.map +0 -1
- package/dist/types/raw/general/Trends.d.ts +0 -324
- package/dist/types/raw/general/Trends.js +0 -3
- package/dist/types/raw/general/Trends.js.map +0 -1
- package/dist/types/raw/query/tweet/Details.d.ts +0 -80
- package/dist/types/raw/query/tweet/Details.js +0 -5
- package/dist/types/raw/query/tweet/Details.js.map +0 -1
- package/dist/types/raw/query/tweet/Engagements.js +0 -3
- package/dist/types/raw/query/tweet/Engagements.js.map +0 -1
- package/dist/types/raw/query/tweet/Likes.d.ts +0 -29
- package/dist/types/raw/query/tweet/Likes.js +0 -3
- package/dist/types/raw/query/tweet/Likes.js.map +0 -1
- package/dist/types/raw/query/tweet/Retweets.d.ts +0 -29
- package/dist/types/raw/query/tweet/Retweets.js +0 -3
- package/dist/types/raw/query/tweet/Retweets.js.map +0 -1
- package/dist/types/raw/query/tweet/Search.d.ts +0 -40
- package/dist/types/raw/query/tweet/Search.js +0 -3
- package/dist/types/raw/query/tweet/Search.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetDetails.d.ts +0 -34
- package/dist/types/raw/query/tweet/TweetDetails.js +0 -5
- package/dist/types/raw/query/tweet/TweetDetails.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetLike.d.ts +0 -29
- package/dist/types/raw/query/tweet/TweetLike.js +0 -3
- package/dist/types/raw/query/tweet/TweetLike.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetLikes.d.ts +0 -29
- package/dist/types/raw/query/tweet/TweetLikes.js +0 -3
- package/dist/types/raw/query/tweet/TweetLikes.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetRetweets.d.ts +0 -0
- package/dist/types/raw/query/tweet/TweetRetweets.js +0 -2
- package/dist/types/raw/query/tweet/TweetRetweets.js.map +0 -1
- package/dist/types/raw/query/user/Details.d.ts +0 -34
- package/dist/types/raw/query/user/Details.js +0 -3
- package/dist/types/raw/query/user/Details.js.map +0 -1
- package/dist/types/raw/tweet/Favouriters.d.ts +0 -164
- package/dist/types/raw/tweet/Favouriters.js +0 -3
- package/dist/types/raw/tweet/Favouriters.js.map +0 -1
- package/dist/types/raw/tweet/Retweeters.js +0 -3
- package/dist/types/raw/tweet/Retweeters.js.map +0 -1
- package/dist/types/raw/tweet/Tweet.d.ts +0 -746
- package/dist/types/raw/tweet/Tweet.js +0 -3
- package/dist/types/raw/tweet/Tweet.js.map +0 -1
- package/dist/types/raw/tweet/Tweets.js +0 -3
- package/dist/types/raw/tweet/Tweets.js.map +0 -1
- package/dist/types/raw/user/Followers.js +0 -3
- package/dist/types/raw/user/Followers.js.map +0 -1
- package/dist/types/raw/user/Following.js +0 -3
- package/dist/types/raw/user/Following.js.map +0 -1
- package/dist/types/raw/user/Likes.d.ts +0 -1059
- package/dist/types/raw/user/Likes.js +0 -3
- package/dist/types/raw/user/Likes.js.map +0 -1
- package/dist/types/raw/user/Tweets.js +0 -3
- package/dist/types/raw/user/Tweets.js.map +0 -1
- package/dist/types/raw/user/User.js.map +0 -1
- package/dist/types/services/args/TweetFilter.d.ts +0 -50
- package/dist/types/services/args/TweetFilter.js +0 -76
- package/dist/types/services/args/TweetFilter.js.map +0 -1
- package/src/services/helper/urls/Tweets.ts +0 -46
- package/src/services/helper/urls/Users.ts +0 -78
- /package/src/{types/raw → twitter/types}/tweet/Favouriters.ts +0 -0
- /package/src/{types/raw → twitter/types}/tweet/Retweeters.ts +0 -0
- /package/src/{types/raw → twitter/types}/tweet/Tweet.ts +0 -0
- /package/src/{types/raw → twitter/types}/tweet/Tweets.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/Followers.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/Following.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/Likes.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/User.ts +0 -0
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
-
function step(op) {
|
|
50
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
-
while (_) try {
|
|
52
|
-
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;
|
|
53
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
-
switch (op[0]) {
|
|
55
|
-
case 0: case 1: t = op; break;
|
|
56
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
-
default:
|
|
60
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
-
if (t[2]) _.ops.pop();
|
|
65
|
-
_.trys.pop(); continue;
|
|
66
|
-
}
|
|
67
|
-
op = body.call(thisArg, _);
|
|
68
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
exports.__esModule = true;
|
|
73
|
-
exports.FetcherService = exports.HttpMethods = void 0;
|
|
74
|
-
// PACKAGES
|
|
75
|
-
var node_libcurl_1 = require("node-libcurl");
|
|
76
|
-
var CacheService_1 = require("./CacheService");
|
|
77
|
-
// MODELS
|
|
78
|
-
var Tweet_1 = require("../../models/data/Tweet");
|
|
79
|
-
var User_1 = require("../../models/data/User");
|
|
80
|
-
// ENUMS
|
|
81
|
-
var HTTP_1 = require("../../enums/HTTP");
|
|
82
|
-
// HELPERS
|
|
83
|
-
var Headers = __importStar(require("../helper/Headers"));
|
|
84
|
-
/**
|
|
85
|
-
* The different types of http requests.
|
|
86
|
-
*/
|
|
87
|
-
var HttpMethods;
|
|
88
|
-
(function (HttpMethods) {
|
|
89
|
-
HttpMethods["POST"] = "POST";
|
|
90
|
-
HttpMethods["GET"] = "GET";
|
|
91
|
-
})(HttpMethods = exports.HttpMethods || (exports.HttpMethods = {}));
|
|
92
|
-
;
|
|
93
|
-
/**
|
|
94
|
-
* Handles all HTTP requests.
|
|
95
|
-
* @internal
|
|
96
|
-
*
|
|
97
|
-
* This serves as the base service from which all other data services derive their behaviour.
|
|
98
|
-
*/
|
|
99
|
-
var FetcherService = /** @class */ (function () {
|
|
100
|
-
// MEMBER METHODS
|
|
101
|
-
/**
|
|
102
|
-
* @param auth The AuthService instance to use for authentication.
|
|
103
|
-
*/
|
|
104
|
-
function FetcherService(auth) {
|
|
105
|
-
this.auth = auth;
|
|
106
|
-
this.cache = CacheService_1.CacheService.getInstance();
|
|
107
|
-
this.isAuthenticated = this.auth.isAuthenticated;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* The middleware for handling any HTTP error.
|
|
111
|
-
*
|
|
112
|
-
* @param res The response object received.
|
|
113
|
-
*
|
|
114
|
-
* @returns The received response, if no HTTP errors are found.
|
|
115
|
-
*
|
|
116
|
-
* @throws {@link HttpStatus} error, if any HTTP error is found.
|
|
117
|
-
*/
|
|
118
|
-
FetcherService.prototype.handleHTTPError = function (res) {
|
|
119
|
-
/**
|
|
120
|
-
* If the status code is not 200 => the HTTP request was not successful. hence throwing error
|
|
121
|
-
*/
|
|
122
|
-
if (res.statusCode != 200 && res.statusCode in HTTP_1.HttpStatus) {
|
|
123
|
-
throw new Error(HTTP_1.HttpStatus[res.statusCode]);
|
|
124
|
-
}
|
|
125
|
-
return res;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Creates an HTTP request according to the given parameters.
|
|
129
|
-
*
|
|
130
|
-
* This method internally uses node-libcurl library to make curl requests to the URL, instead of node-fetch.
|
|
131
|
-
* This has been done since that way it better mimics the HTTP requests made from browser.
|
|
132
|
-
*
|
|
133
|
-
* @param url The url to fetch data from.
|
|
134
|
-
* @param authenticate Whether to authenticate requests or not.
|
|
135
|
-
* @param method The HTTP method (from {@link HttpMethods}) to use.
|
|
136
|
-
* @param data The data to be sent along with the request (for POST request).
|
|
137
|
-
*
|
|
138
|
-
* @returns The {@link CurlyResult} received.
|
|
139
|
-
*/
|
|
140
|
-
FetcherService.prototype.request = function (url, authenticate, method, data) {
|
|
141
|
-
if (authenticate === void 0) { authenticate = true; }
|
|
142
|
-
if (method === void 0) { method = HttpMethods.GET; }
|
|
143
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
-
var config, _a, _b, _c, _d, _e;
|
|
145
|
-
var _f;
|
|
146
|
-
var _this = this;
|
|
147
|
-
return __generator(this, function (_g) {
|
|
148
|
-
switch (_g.label) {
|
|
149
|
-
case 0:
|
|
150
|
-
_f = {};
|
|
151
|
-
if (!authenticate) return [3 /*break*/, 2];
|
|
152
|
-
_c = (_b = Headers).authorizedHeader;
|
|
153
|
-
return [4 /*yield*/, this.auth.getAuthCredentials()];
|
|
154
|
-
case 1:
|
|
155
|
-
_a = _c.apply(_b, [_g.sent()]);
|
|
156
|
-
return [3 /*break*/, 4];
|
|
157
|
-
case 2:
|
|
158
|
-
_e = (_d = Headers).guestHeader;
|
|
159
|
-
return [4 /*yield*/, this.auth.getGuestCredentials()];
|
|
160
|
-
case 3:
|
|
161
|
-
_a = _e.apply(_d, [_g.sent()]);
|
|
162
|
-
_g.label = 4;
|
|
163
|
-
case 4:
|
|
164
|
-
config = (
|
|
165
|
-
/**
|
|
166
|
-
* If authorization is required, using the authenticated header, using the authentication credentiials.
|
|
167
|
-
* Else, using the guest header, using the guest credentials.
|
|
168
|
-
*/
|
|
169
|
-
_f.httpHeader = _a,
|
|
170
|
-
/**
|
|
171
|
-
* Disabling SSL peer verification because verification causes Error 404 (only while fetching tweets), likely because peer verification fails.
|
|
172
|
-
*/
|
|
173
|
-
_f.sslVerifyPeer = false,
|
|
174
|
-
_f);
|
|
175
|
-
if (!(method == HttpMethods.POST)) return [3 /*break*/, 6];
|
|
176
|
-
return [4 /*yield*/, node_libcurl_1.curly.post(url, __assign(__assign({}, config), { postFields: JSON.stringify(data) })).then(function (res) { return _this.handleHTTPError(res); })];
|
|
177
|
-
case 5: return [2 /*return*/, _g.sent()];
|
|
178
|
-
case 6: return [4 /*yield*/, node_libcurl_1.curly.get(url, config).then(function (res) { return _this.handleHTTPError(res); })];
|
|
179
|
-
case 7: return [2 /*return*/, _g.sent()];
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Caches the extracted data into the {@link CacheService} instance.
|
|
186
|
-
*
|
|
187
|
-
* @param data The extracted data to be cached.
|
|
188
|
-
*/
|
|
189
|
-
FetcherService.prototype.cacheData = function (data) {
|
|
190
|
-
/**
|
|
191
|
-
* The extracted data is in raw form.
|
|
192
|
-
* This raw data is deserialized into the respective known types.
|
|
193
|
-
*/
|
|
194
|
-
var users = data.users.map(function (user) { return new User_1.User(user); });
|
|
195
|
-
var tweets = data.tweets.map(function (tweet) { return new Tweet_1.Tweet(tweet); });
|
|
196
|
-
// Caching the data
|
|
197
|
-
this.cache.write(users);
|
|
198
|
-
this.cache.write(tweets);
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* Fetches the data with the given id from the cache.
|
|
202
|
-
*
|
|
203
|
-
* @param id The id of the data to be read from cache.
|
|
204
|
-
*
|
|
205
|
-
* @returns The data with the given id. If does not exists, returns undefined.
|
|
206
|
-
*/
|
|
207
|
-
FetcherService.prototype.readData = function (id) {
|
|
208
|
-
// Reading data from cache
|
|
209
|
-
return this.cache.read(id);
|
|
210
|
-
};
|
|
211
|
-
return FetcherService;
|
|
212
|
-
}());
|
|
213
|
-
exports.FetcherService = FetcherService;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (_) try {
|
|
52
|
+
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;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.__esModule = true;
|
|
73
|
+
exports.FetcherService = exports.HttpMethods = void 0;
|
|
74
|
+
// PACKAGES
|
|
75
|
+
var node_libcurl_1 = require("node-libcurl");
|
|
76
|
+
var CacheService_1 = require("./CacheService");
|
|
77
|
+
// MODELS
|
|
78
|
+
var Tweet_1 = require("../../models/data/Tweet");
|
|
79
|
+
var User_1 = require("../../models/data/User");
|
|
80
|
+
// ENUMS
|
|
81
|
+
var HTTP_1 = require("../../enums/HTTP");
|
|
82
|
+
// HELPERS
|
|
83
|
+
var Headers = __importStar(require("../helper/Headers"));
|
|
84
|
+
/**
|
|
85
|
+
* The different types of http requests.
|
|
86
|
+
*/
|
|
87
|
+
var HttpMethods;
|
|
88
|
+
(function (HttpMethods) {
|
|
89
|
+
HttpMethods["POST"] = "POST";
|
|
90
|
+
HttpMethods["GET"] = "GET";
|
|
91
|
+
})(HttpMethods = exports.HttpMethods || (exports.HttpMethods = {}));
|
|
92
|
+
;
|
|
93
|
+
/**
|
|
94
|
+
* Handles all HTTP requests.
|
|
95
|
+
* @internal
|
|
96
|
+
*
|
|
97
|
+
* This serves as the base service from which all other data services derive their behaviour.
|
|
98
|
+
*/
|
|
99
|
+
var FetcherService = /** @class */ (function () {
|
|
100
|
+
// MEMBER METHODS
|
|
101
|
+
/**
|
|
102
|
+
* @param auth The AuthService instance to use for authentication.
|
|
103
|
+
*/
|
|
104
|
+
function FetcherService(auth) {
|
|
105
|
+
this.auth = auth;
|
|
106
|
+
this.cache = CacheService_1.CacheService.getInstance();
|
|
107
|
+
this.isAuthenticated = this.auth.isAuthenticated;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The middleware for handling any HTTP error.
|
|
111
|
+
*
|
|
112
|
+
* @param res The response object received.
|
|
113
|
+
*
|
|
114
|
+
* @returns The received response, if no HTTP errors are found.
|
|
115
|
+
*
|
|
116
|
+
* @throws {@link HttpStatus} error, if any HTTP error is found.
|
|
117
|
+
*/
|
|
118
|
+
FetcherService.prototype.handleHTTPError = function (res) {
|
|
119
|
+
/**
|
|
120
|
+
* If the status code is not 200 => the HTTP request was not successful. hence throwing error
|
|
121
|
+
*/
|
|
122
|
+
if (res.statusCode != 200 && res.statusCode in HTTP_1.HttpStatus) {
|
|
123
|
+
throw new Error(HTTP_1.HttpStatus[res.statusCode]);
|
|
124
|
+
}
|
|
125
|
+
return res;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Creates an HTTP request according to the given parameters.
|
|
129
|
+
*
|
|
130
|
+
* This method internally uses node-libcurl library to make curl requests to the URL, instead of node-fetch.
|
|
131
|
+
* This has been done since that way it better mimics the HTTP requests made from browser.
|
|
132
|
+
*
|
|
133
|
+
* @param url The url to fetch data from.
|
|
134
|
+
* @param authenticate Whether to authenticate requests or not.
|
|
135
|
+
* @param method The HTTP method (from {@link HttpMethods}) to use.
|
|
136
|
+
* @param data The data to be sent along with the request (for POST request).
|
|
137
|
+
*
|
|
138
|
+
* @returns The {@link CurlyResult} received.
|
|
139
|
+
*/
|
|
140
|
+
FetcherService.prototype.request = function (url, authenticate, method, data) {
|
|
141
|
+
if (authenticate === void 0) { authenticate = true; }
|
|
142
|
+
if (method === void 0) { method = HttpMethods.GET; }
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var config, _a, _b, _c, _d, _e;
|
|
145
|
+
var _f;
|
|
146
|
+
var _this = this;
|
|
147
|
+
return __generator(this, function (_g) {
|
|
148
|
+
switch (_g.label) {
|
|
149
|
+
case 0:
|
|
150
|
+
_f = {};
|
|
151
|
+
if (!authenticate) return [3 /*break*/, 2];
|
|
152
|
+
_c = (_b = Headers).authorizedHeader;
|
|
153
|
+
return [4 /*yield*/, this.auth.getAuthCredentials()];
|
|
154
|
+
case 1:
|
|
155
|
+
_a = _c.apply(_b, [_g.sent()]);
|
|
156
|
+
return [3 /*break*/, 4];
|
|
157
|
+
case 2:
|
|
158
|
+
_e = (_d = Headers).guestHeader;
|
|
159
|
+
return [4 /*yield*/, this.auth.getGuestCredentials()];
|
|
160
|
+
case 3:
|
|
161
|
+
_a = _e.apply(_d, [_g.sent()]);
|
|
162
|
+
_g.label = 4;
|
|
163
|
+
case 4:
|
|
164
|
+
config = (
|
|
165
|
+
/**
|
|
166
|
+
* If authorization is required, using the authenticated header, using the authentication credentiials.
|
|
167
|
+
* Else, using the guest header, using the guest credentials.
|
|
168
|
+
*/
|
|
169
|
+
_f.httpHeader = _a,
|
|
170
|
+
/**
|
|
171
|
+
* Disabling SSL peer verification because verification causes Error 404 (only while fetching tweets), likely because peer verification fails.
|
|
172
|
+
*/
|
|
173
|
+
_f.sslVerifyPeer = false,
|
|
174
|
+
_f);
|
|
175
|
+
if (!(method == HttpMethods.POST)) return [3 /*break*/, 6];
|
|
176
|
+
return [4 /*yield*/, node_libcurl_1.curly.post(url, __assign(__assign({}, config), { postFields: JSON.stringify(data) })).then(function (res) { return _this.handleHTTPError(res); })];
|
|
177
|
+
case 5: return [2 /*return*/, _g.sent()];
|
|
178
|
+
case 6: return [4 /*yield*/, node_libcurl_1.curly.get(url, config).then(function (res) { return _this.handleHTTPError(res); })];
|
|
179
|
+
case 7: return [2 /*return*/, _g.sent()];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Caches the extracted data into the {@link CacheService} instance.
|
|
186
|
+
*
|
|
187
|
+
* @param data The extracted data to be cached.
|
|
188
|
+
*/
|
|
189
|
+
FetcherService.prototype.cacheData = function (data) {
|
|
190
|
+
/**
|
|
191
|
+
* The extracted data is in raw form.
|
|
192
|
+
* This raw data is deserialized into the respective known types.
|
|
193
|
+
*/
|
|
194
|
+
var users = data.users.map(function (user) { return new User_1.User(user); });
|
|
195
|
+
var tweets = data.tweets.map(function (tweet) { return new Tweet_1.Tweet(tweet); });
|
|
196
|
+
// Caching the data
|
|
197
|
+
this.cache.write(users);
|
|
198
|
+
this.cache.write(tweets);
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Fetches the data with the given id from the cache.
|
|
202
|
+
*
|
|
203
|
+
* @param id The id of the data to be read from cache.
|
|
204
|
+
*
|
|
205
|
+
* @returns The data with the given id. If does not exists, returns undefined.
|
|
206
|
+
*/
|
|
207
|
+
FetcherService.prototype.readData = function (id) {
|
|
208
|
+
// Reading data from cache
|
|
209
|
+
return this.cache.read(id);
|
|
210
|
+
};
|
|
211
|
+
return FetcherService;
|
|
212
|
+
}());
|
|
213
|
+
exports.FetcherService = FetcherService;
|
|
214
214
|
//# sourceMappingURL=FetcherService.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ResourceType } from "./enums/Resources";
|
|
2
|
+
import { Args } from './payloads/Args';
|
|
3
|
+
/**
|
|
4
|
+
* A class that deals with generation of URLs to various resources on Twitter.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Url {
|
|
7
|
+
/** The base Twitter API url. */
|
|
8
|
+
private baseUrl;
|
|
9
|
+
/** The fully initialized target resource URL. */
|
|
10
|
+
fullUrl: string;
|
|
11
|
+
/**
|
|
12
|
+
* Initializes a URL for fetching the specified resource, using the given arguments.
|
|
13
|
+
*
|
|
14
|
+
* @param resourceType The type of resource to fetch.
|
|
15
|
+
* @param args Any additional arguments.
|
|
16
|
+
*/
|
|
17
|
+
constructor(resourceType: ResourceType, args: Args);
|
|
18
|
+
/**
|
|
19
|
+
* @returns The string representation of thi Url.
|
|
20
|
+
*/
|
|
21
|
+
toString(): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.Url = void 0;
|
|
4
|
+
var Query_1 = require("./params/Query");
|
|
5
|
+
/**
|
|
6
|
+
* A class that deals with generation of URLs to various resources on Twitter.
|
|
7
|
+
*/
|
|
8
|
+
var Url = /** @class */ (function () {
|
|
9
|
+
/**
|
|
10
|
+
* Initializes a URL for fetching the specified resource, using the given arguments.
|
|
11
|
+
*
|
|
12
|
+
* @param resourceType The type of resource to fetch.
|
|
13
|
+
* @param args Any additional arguments.
|
|
14
|
+
*/
|
|
15
|
+
function Url(resourceType, args) {
|
|
16
|
+
/** The base Twitter API url. */
|
|
17
|
+
this.baseUrl = 'https://api.twitter.com';
|
|
18
|
+
/**
|
|
19
|
+
* Initializing full URL along with additional URL parameters.
|
|
20
|
+
*/
|
|
21
|
+
this.fullUrl = "".concat(this.baseUrl).concat(resourceType, "?").concat(new Query_1.Query(resourceType, args).toString());
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @returns The string representation of thi Url.
|
|
25
|
+
*/
|
|
26
|
+
Url.prototype.toString = function () {
|
|
27
|
+
return this.fullUrl;
|
|
28
|
+
};
|
|
29
|
+
return Url;
|
|
30
|
+
}());
|
|
31
|
+
exports.Url = Url;
|
|
32
|
+
//# sourceMappingURL=Url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Url.js","sourceRoot":"","sources":["../../src/twitter/Url.ts"],"names":[],"mappings":";;;AAKA,wCAAuC;AAEvC;;GAEG;AACH;IAOI;;;;;OAKG;IACH,aAAY,YAA0B,EAAE,IAAU;QAZlD,gCAAgC;QACxB,YAAO,GAAW,yBAAyB,CAAC;QAYhD;;WAEG;QACH,IAAI,CAAC,OAAO,GAAG,UAAG,IAAI,CAAC,OAAO,SAAG,YAAY,cAAI,IAAI,aAAK,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAE,CAAC;IAChG,CAAC;IAED;;OAEG;IACI,sBAAQ,GAAf;QACI,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACL,UAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,kBAAG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The different types of resources that can be fetched.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum ResourceType {
|
|
5
|
+
'TWEETS' = "/2/search/adaptive.json",
|
|
6
|
+
'TWEET_DETAILS' = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail",
|
|
7
|
+
'TWEET_LIKES' = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters",
|
|
8
|
+
'TWEET_RETWEETS' = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters",
|
|
9
|
+
'USER_DETAILS' = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName",
|
|
10
|
+
'USER_DETAILS_BY_ID' = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId",
|
|
11
|
+
'USER_TWEETS' = "/graphql/xxLjoOBBPpYBHbBTI-hevQ/UserTweetsAndReplies",
|
|
12
|
+
'USER_FOLLOWING' = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following",
|
|
13
|
+
'USER_FOLLOWERS' = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers",
|
|
14
|
+
'USER_LIKES' = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes"
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.ResourceType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The different types of resources that can be fetched.
|
|
6
|
+
*/
|
|
7
|
+
var ResourceType;
|
|
8
|
+
(function (ResourceType) {
|
|
9
|
+
ResourceType["TWEETS"] = "/2/search/adaptive.json";
|
|
10
|
+
ResourceType["TWEET_DETAILS"] = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail";
|
|
11
|
+
ResourceType["TWEET_LIKES"] = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters";
|
|
12
|
+
ResourceType["TWEET_RETWEETS"] = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters";
|
|
13
|
+
ResourceType["USER_DETAILS"] = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName";
|
|
14
|
+
ResourceType["USER_DETAILS_BY_ID"] = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId";
|
|
15
|
+
ResourceType["USER_TWEETS"] = "/graphql/xxLjoOBBPpYBHbBTI-hevQ/UserTweetsAndReplies";
|
|
16
|
+
ResourceType["USER_FOLLOWING"] = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following";
|
|
17
|
+
ResourceType["USER_FOLLOWERS"] = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers";
|
|
18
|
+
ResourceType["USER_LIKES"] = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes";
|
|
19
|
+
})(ResourceType = exports.ResourceType || (exports.ResourceType = {}));
|
|
20
|
+
;
|
|
21
|
+
//# sourceMappingURL=Resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resources.js","sourceRoot":"","sources":["../../../src/twitter/enums/Resources.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,YAWX;AAXD,WAAY,YAAY;IACpB,kDAAoC,CAAA;IACpC,6EAA+D,CAAA;IAC/D,0EAA4D,CAAA;IAC5D,6EAA+D,CAAA;IAC/D,iFAAmE,CAAA;IACnE,mFAAqE,CAAA;IACrE,oFAAsE,CAAA;IACtE,4EAA8D,CAAA;IAC9D,4EAA8D,CAAA;IAC9D,oEAAsD,CAAA;AAC1D,CAAC,EAXW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAWvB;AAAA,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Args } from '../payloads/Args';
|
|
2
|
+
import { IQuery } from '../types/request/Query';
|
|
3
|
+
import { ResourceType } from '../enums/Resources';
|
|
4
|
+
/**
|
|
5
|
+
* The URL query parameters that must be sent while making requests to Twitter API.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Query implements IQuery {
|
|
8
|
+
cards_platform?: string;
|
|
9
|
+
count?: number;
|
|
10
|
+
cursor?: string;
|
|
11
|
+
ext?: string;
|
|
12
|
+
include_blocked_by?: number;
|
|
13
|
+
include_blocking?: number;
|
|
14
|
+
include_can_dm?: number;
|
|
15
|
+
include_can_media_tag?: number;
|
|
16
|
+
include_cards?: number;
|
|
17
|
+
include_entities?: boolean;
|
|
18
|
+
include_ext_alt_text?: boolean;
|
|
19
|
+
include_ext_collab_control?: boolean;
|
|
20
|
+
include_ext_edit_control?: boolean;
|
|
21
|
+
include_ext_has_nft_avatar?: number;
|
|
22
|
+
include_ext_is_blue_verified?: number;
|
|
23
|
+
include_ext_limited_action_results?: boolean;
|
|
24
|
+
include_ext_media_availability?: boolean;
|
|
25
|
+
include_ext_media_color?: boolean;
|
|
26
|
+
include_ext_sensitive_media_warning?: boolean;
|
|
27
|
+
include_ext_trusted_friends_metadata?: boolean;
|
|
28
|
+
include_ext_verified_type?: number;
|
|
29
|
+
include_ext_views?: boolean;
|
|
30
|
+
include_followed_by?: number;
|
|
31
|
+
include_mute_edge?: number;
|
|
32
|
+
include_profile_interstitial_type?: number;
|
|
33
|
+
include_quote_count?: boolean;
|
|
34
|
+
include_reply_count?: number;
|
|
35
|
+
include_user_entities?: boolean;
|
|
36
|
+
include_want_retweets?: number;
|
|
37
|
+
pc?: number;
|
|
38
|
+
q?: string;
|
|
39
|
+
query_source?: string;
|
|
40
|
+
send_error_codes?: boolean;
|
|
41
|
+
simple_quoted_tweet?: boolean;
|
|
42
|
+
skip_status?: number;
|
|
43
|
+
spelling_corrections?: number;
|
|
44
|
+
tweet_mode?: string;
|
|
45
|
+
tweet_search_mode?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Variables for fetching data.
|
|
48
|
+
*/
|
|
49
|
+
variables?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Additional data features that must be fetched.
|
|
52
|
+
*/
|
|
53
|
+
features?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Initializes the URL parameters.
|
|
56
|
+
*
|
|
57
|
+
* @param resourceType The type of resource requested.
|
|
58
|
+
* @param args Additional user-defined arguments to be sent in the request.
|
|
59
|
+
*/
|
|
60
|
+
constructor(resourceType: ResourceType, args: Args);
|
|
61
|
+
/**
|
|
62
|
+
* Converts this object to it's string representation.
|
|
63
|
+
*
|
|
64
|
+
* @returns 'this' object's string representation;
|
|
65
|
+
*/
|
|
66
|
+
toString(): string;
|
|
67
|
+
}
|