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,392 +1,412 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
exports.__esModule = true;
|
|
42
|
-
exports.AccountService = void 0;
|
|
43
|
-
// PACKAGES
|
|
44
|
-
var node_libcurl_1 = require("node-libcurl");
|
|
45
|
-
// SERVICES
|
|
46
|
-
var AuthService_1 = require("./AuthService");
|
|
47
|
-
// ENUMS
|
|
48
|
-
var HTTP_1 = require("../../enums/HTTP");
|
|
49
|
-
var Errors_1 = require("../../enums/Errors");
|
|
50
|
-
// HELPERS
|
|
51
|
-
var LoginFlows_1 = __importDefault(require("../helper/payloads/LoginFlows"));
|
|
52
|
-
var Headers_1 = require("../helper/Headers");
|
|
53
|
-
var cookiejar_1 = require("cookiejar");
|
|
54
|
-
/**
|
|
55
|
-
* Handles all operations related to a user's account, such as loggin in, managing account, etc
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
var AccountService = /** @class */ (function () {
|
|
59
|
-
function AccountService() {
|
|
60
|
-
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
case
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
case
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
_e =
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
//
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
case
|
|
314
|
-
_a.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return [4 /*yield*/, this.
|
|
319
|
-
case 4
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
* @
|
|
338
|
-
*
|
|
339
|
-
* @
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
*
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
* @
|
|
365
|
-
*
|
|
366
|
-
* @param
|
|
367
|
-
*
|
|
368
|
-
* @
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
exports.__esModule = true;
|
|
42
|
+
exports.AccountService = void 0;
|
|
43
|
+
// PACKAGES
|
|
44
|
+
var node_libcurl_1 = require("node-libcurl");
|
|
45
|
+
// SERVICES
|
|
46
|
+
var AuthService_1 = require("./AuthService");
|
|
47
|
+
// ENUMS
|
|
48
|
+
var HTTP_1 = require("../../enums/HTTP");
|
|
49
|
+
var Errors_1 = require("../../enums/Errors");
|
|
50
|
+
// HELPERS
|
|
51
|
+
var LoginFlows_1 = __importDefault(require("../helper/payloads/LoginFlows"));
|
|
52
|
+
var Headers_1 = require("../helper/Headers");
|
|
53
|
+
var cookiejar_1 = require("cookiejar");
|
|
54
|
+
/**
|
|
55
|
+
* Handles all operations related to a user's account, such as loggin in, managing account, etc
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
var AccountService = /** @class */ (function () {
|
|
59
|
+
function AccountService() {
|
|
60
|
+
/** The AuthService instance to use for authentication. */
|
|
61
|
+
this.auth = new AuthService_1.AuthService();
|
|
62
|
+
/** The current guest credentials to use. */
|
|
63
|
+
this.guestCreds = { authToken: '', guestToken: '' };
|
|
64
|
+
/** The email id of Twitter account to be logged into. */
|
|
65
|
+
this.email = '';
|
|
66
|
+
/** The user name of the Twitter account ot be logged into */
|
|
67
|
+
this.userName = '';
|
|
68
|
+
/** The password to the Twitter account to be logged into. */
|
|
69
|
+
this.password = '';
|
|
70
|
+
/** The cookies received from Twitter after logging in. */
|
|
71
|
+
this.cookies = [];
|
|
72
|
+
/** The flow token received after execution of current flow. */
|
|
73
|
+
this.flowToken = '';
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @returns The current guest credentials to use. If if does not exists, then a new one is created
|
|
77
|
+
*/
|
|
78
|
+
AccountService.prototype.getGuestCredentials = function () {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
var _a;
|
|
81
|
+
return __generator(this, function (_b) {
|
|
82
|
+
switch (_b.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
if (!!this.guestCreds.guestToken) return [3 /*break*/, 2];
|
|
85
|
+
_a = this;
|
|
86
|
+
return [4 /*yield*/, this.auth.getGuestCredentials()];
|
|
87
|
+
case 1:
|
|
88
|
+
_a.guestCreds = _b.sent();
|
|
89
|
+
_b.label = 2;
|
|
90
|
+
case 2: return [2 /*return*/, this.guestCreds];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Step 1: Initiates login
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
AccountService.prototype.initiateLogin = function () {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var res, _a, _b, _c, _d;
|
|
102
|
+
var _e;
|
|
103
|
+
return __generator(this, function (_f) {
|
|
104
|
+
switch (_f.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
_b = (_a = node_libcurl_1.curly).post;
|
|
107
|
+
_c = [LoginFlows_1["default"].InitiateLogin.url];
|
|
108
|
+
_e = {};
|
|
109
|
+
_d = Headers_1.loginHeader;
|
|
110
|
+
return [4 /*yield*/, this.getGuestCredentials()];
|
|
111
|
+
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_e.httpHeader = _d.apply(void 0, [_f.sent(), this.cookies.toString()]),
|
|
112
|
+
_e.sslVerifyPeer = false,
|
|
113
|
+
_e.postFields = '',
|
|
114
|
+
_e)]))];
|
|
115
|
+
case 2:
|
|
116
|
+
res = _f.sent();
|
|
117
|
+
// Storing cookies received
|
|
118
|
+
this.cookies = new cookiejar_1.CookieJar().setCookies(res.headers[0]['Set-Cookie']);
|
|
119
|
+
// Getting the flow token
|
|
120
|
+
this.flowToken = res.data['flow_token'];
|
|
121
|
+
// Executing next subtask
|
|
122
|
+
return [4 /*yield*/, this.jsInstrumentationSubtask()];
|
|
123
|
+
case 3:
|
|
124
|
+
// Executing next subtask
|
|
125
|
+
_f.sent();
|
|
126
|
+
return [2 /*return*/];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Step 2: Does something
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
AccountService.prototype.jsInstrumentationSubtask = function () {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
+
var res, _a, _b, _c, _d;
|
|
138
|
+
var _e;
|
|
139
|
+
return __generator(this, function (_f) {
|
|
140
|
+
switch (_f.label) {
|
|
141
|
+
case 0:
|
|
142
|
+
_b = (_a = node_libcurl_1.curly).post;
|
|
143
|
+
_c = [LoginFlows_1["default"].JsInstrumentationSubtask.url];
|
|
144
|
+
_e = {};
|
|
145
|
+
_d = Headers_1.loginHeader;
|
|
146
|
+
return [4 /*yield*/, this.getGuestCredentials()];
|
|
147
|
+
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_e.httpHeader = _d.apply(void 0, [_f.sent(), this.cookies.join(';').toString()]),
|
|
148
|
+
_e.sslVerifyPeer = false,
|
|
149
|
+
_e.postFields = JSON.stringify(LoginFlows_1["default"].JsInstrumentationSubtask.body(this.flowToken)),
|
|
150
|
+
_e)]))];
|
|
151
|
+
case 2:
|
|
152
|
+
res = _f.sent();
|
|
153
|
+
// Getting the flow token
|
|
154
|
+
this.flowToken = res.data['flow_token'];
|
|
155
|
+
// Executing next subtask
|
|
156
|
+
return [4 /*yield*/, this.enterUserIdentifier()];
|
|
157
|
+
case 3:
|
|
158
|
+
// Executing next subtask
|
|
159
|
+
_f.sent();
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Step 3: Takes the email for login
|
|
167
|
+
* @internal
|
|
168
|
+
*
|
|
169
|
+
* @throws {@link AuthenticationErrors.InvalidEmail}, if email does not exist.
|
|
170
|
+
*/
|
|
171
|
+
AccountService.prototype.enterUserIdentifier = function () {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
173
|
+
var res, _a, _b, _c, _d, _i, _e, task;
|
|
174
|
+
var _f;
|
|
175
|
+
return __generator(this, function (_g) {
|
|
176
|
+
switch (_g.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
_b = (_a = node_libcurl_1.curly).post;
|
|
179
|
+
_c = [LoginFlows_1["default"].EnterUserIdentifier.url];
|
|
180
|
+
_f = {};
|
|
181
|
+
_d = Headers_1.loginHeader;
|
|
182
|
+
return [4 /*yield*/, this.getGuestCredentials()];
|
|
183
|
+
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_f.httpHeader = _d.apply(void 0, [_g.sent(), this.cookies.join(';').toString()]),
|
|
184
|
+
_f.sslVerifyPeer = false,
|
|
185
|
+
_f.postFields = JSON.stringify(LoginFlows_1["default"].EnterUserIdentifier.body(this.flowToken, this.email)),
|
|
186
|
+
_f)]))];
|
|
187
|
+
case 2:
|
|
188
|
+
res = _g.sent();
|
|
189
|
+
// If no account found with given email
|
|
190
|
+
if (res.statusCode == HTTP_1.HttpStatus.BadRequest && res.data.errors[0].code == 399) {
|
|
191
|
+
throw new Error(Errors_1.AuthenticationErrors.InvalidEmail);
|
|
192
|
+
}
|
|
193
|
+
// Getting the flow token
|
|
194
|
+
this.flowToken = res.data['flow_token'];
|
|
195
|
+
_i = 0, _e = res.data.subtasks;
|
|
196
|
+
_g.label = 3;
|
|
197
|
+
case 3:
|
|
198
|
+
if (!(_i < _e.length)) return [3 /*break*/, 8];
|
|
199
|
+
task = _e[_i];
|
|
200
|
+
if (!(task['subtask_id'] == 'LoginEnterAlternateIdentifierSubtask')) return [3 /*break*/, 5];
|
|
201
|
+
// Executing next subtask
|
|
202
|
+
return [4 /*yield*/, this.enterAlternateUserIdentifier()];
|
|
203
|
+
case 4:
|
|
204
|
+
// Executing next subtask
|
|
205
|
+
_g.sent();
|
|
206
|
+
return [3 /*break*/, 8];
|
|
207
|
+
case 5:
|
|
208
|
+
if (!(task['subtask_id'] == 'LoginEnterPassword')) return [3 /*break*/, 7];
|
|
209
|
+
// Executing next subtask
|
|
210
|
+
return [4 /*yield*/, this.enterPassword()];
|
|
211
|
+
case 6:
|
|
212
|
+
// Executing next subtask
|
|
213
|
+
_g.sent();
|
|
214
|
+
return [3 /*break*/, 8];
|
|
215
|
+
case 7:
|
|
216
|
+
_i++;
|
|
217
|
+
return [3 /*break*/, 3];
|
|
218
|
+
case 8: return [2 /*return*/];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Step 4: Takes the username for login
|
|
225
|
+
* @internal
|
|
226
|
+
*
|
|
227
|
+
* @throws {@link AuthenticationErrors.InvalidUsername}, if wrong username entered.
|
|
228
|
+
*/
|
|
229
|
+
AccountService.prototype.enterAlternateUserIdentifier = function () {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
+
var res, _a, _b, _c, _d;
|
|
232
|
+
var _e;
|
|
233
|
+
return __generator(this, function (_f) {
|
|
234
|
+
switch (_f.label) {
|
|
235
|
+
case 0:
|
|
236
|
+
_b = (_a = node_libcurl_1.curly).post;
|
|
237
|
+
_c = [LoginFlows_1["default"].EnterAlternateUserIdentifier.url];
|
|
238
|
+
_e = {};
|
|
239
|
+
_d = Headers_1.loginHeader;
|
|
240
|
+
return [4 /*yield*/, this.getGuestCredentials()];
|
|
241
|
+
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_e.httpHeader = _d.apply(void 0, [_f.sent(), this.cookies.join(';').toString()]),
|
|
242
|
+
_e.sslVerifyPeer = false,
|
|
243
|
+
_e.postFields = JSON.stringify(LoginFlows_1["default"].EnterAlternateUserIdentifier.body(this.flowToken, this.userName)),
|
|
244
|
+
_e)]))];
|
|
245
|
+
case 2:
|
|
246
|
+
res = _f.sent();
|
|
247
|
+
// If invalid username for the given account
|
|
248
|
+
if (res.statusCode == HTTP_1.HttpStatus.BadRequest && res.data.errors[0].code == 399) {
|
|
249
|
+
throw new Error(Errors_1.AuthenticationErrors.InvalidUsername);
|
|
250
|
+
}
|
|
251
|
+
// Getting the flow token
|
|
252
|
+
this.flowToken = res.data['flow_token'];
|
|
253
|
+
// Executing next subtask
|
|
254
|
+
return [4 /*yield*/, this.enterPassword()];
|
|
255
|
+
case 3:
|
|
256
|
+
// Executing next subtask
|
|
257
|
+
_f.sent();
|
|
258
|
+
return [2 /*return*/];
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Step 5: Takes the password for login
|
|
265
|
+
* @internal
|
|
266
|
+
*
|
|
267
|
+
* @throws {@link AuthenticationErrors.InvalidPassword}, incorrect password entered.
|
|
268
|
+
*/
|
|
269
|
+
AccountService.prototype.enterPassword = function () {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
271
|
+
var res, _a, _b, _c, _d;
|
|
272
|
+
var _e;
|
|
273
|
+
return __generator(this, function (_f) {
|
|
274
|
+
switch (_f.label) {
|
|
275
|
+
case 0:
|
|
276
|
+
_b = (_a = node_libcurl_1.curly).post;
|
|
277
|
+
_c = [LoginFlows_1["default"].EnterPassword.url];
|
|
278
|
+
_e = {};
|
|
279
|
+
_d = Headers_1.loginHeader;
|
|
280
|
+
return [4 /*yield*/, this.getGuestCredentials()];
|
|
281
|
+
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_e.httpHeader = _d.apply(void 0, [_f.sent(), this.cookies.join(';').toString()]),
|
|
282
|
+
_e.sslVerifyPeer = false,
|
|
283
|
+
_e.postFields = JSON.stringify(LoginFlows_1["default"].EnterPassword.body(this.flowToken, this.password)),
|
|
284
|
+
_e)]))];
|
|
285
|
+
case 2:
|
|
286
|
+
res = _f.sent();
|
|
287
|
+
// If invalid password for the given account
|
|
288
|
+
if (res.statusCode == HTTP_1.HttpStatus.BadRequest && res.data.errors[0].code == 399) {
|
|
289
|
+
throw new Error(Errors_1.AuthenticationErrors.InvalidPassword);
|
|
290
|
+
}
|
|
291
|
+
// Getting the flow token
|
|
292
|
+
this.flowToken = res.data['flow_token'];
|
|
293
|
+
// Executing next subtask
|
|
294
|
+
return [4 /*yield*/, this.accountDuplicationCheck()];
|
|
295
|
+
case 3:
|
|
296
|
+
// Executing next subtask
|
|
297
|
+
_f.sent();
|
|
298
|
+
return [2 /*return*/];
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Step 6: Gets the actual cookies
|
|
305
|
+
* @internal
|
|
306
|
+
*/
|
|
307
|
+
AccountService.prototype.accountDuplicationCheck = function () {
|
|
308
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
309
|
+
var res, _a, _b, _c, _d;
|
|
310
|
+
var _e;
|
|
311
|
+
return __generator(this, function (_f) {
|
|
312
|
+
switch (_f.label) {
|
|
313
|
+
case 0:
|
|
314
|
+
_b = (_a = node_libcurl_1.curly).post;
|
|
315
|
+
_c = [LoginFlows_1["default"].AccountDuplicationCheck.url];
|
|
316
|
+
_e = {};
|
|
317
|
+
_d = Headers_1.loginHeader;
|
|
318
|
+
return [4 /*yield*/, this.getGuestCredentials()];
|
|
319
|
+
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_e.httpHeader = _d.apply(void 0, [_f.sent(), this.cookies.join(';').toString()]),
|
|
320
|
+
_e.sslVerifyPeer = false,
|
|
321
|
+
_e.postFields = JSON.stringify(LoginFlows_1["default"].AccountDuplicationCheck.body(this.flowToken)),
|
|
322
|
+
_e)]))];
|
|
323
|
+
case 2:
|
|
324
|
+
res = _f.sent();
|
|
325
|
+
// Getting the cookies from the set-cookie header of the reponse.
|
|
326
|
+
this.cookies = new cookiejar_1.CookieJar().setCookies(res.headers[0]['Set-Cookie']);
|
|
327
|
+
// Getting the flow token
|
|
328
|
+
this.flowToken = res.data['flow_token'];
|
|
329
|
+
return [2 /*return*/];
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Parse the authentication cookies recieved from Twitter into known format.
|
|
336
|
+
*
|
|
337
|
+
* @internal
|
|
338
|
+
*
|
|
339
|
+
* @param cookies The raw cookies received from Twitter.
|
|
340
|
+
*
|
|
341
|
+
* @returns The parsed cookies of type {@link AuthCookie}
|
|
342
|
+
*/
|
|
343
|
+
AccountService.prototype.parseCookies = function (cookies) {
|
|
344
|
+
/** The tempoorary parsed cookies. */
|
|
345
|
+
var tempCookies = {};
|
|
346
|
+
/**
|
|
347
|
+
* Parsing the cookies into a standard JSON format.
|
|
348
|
+
* The format is 'cookie_name': 'cookie_value'.
|
|
349
|
+
* All other cookie parameters like expiry, etc are dropped.
|
|
350
|
+
*/
|
|
351
|
+
cookies.forEach(function (cookie) {
|
|
352
|
+
tempCookies[cookie.name] = cookie.value;
|
|
353
|
+
});
|
|
354
|
+
return {
|
|
355
|
+
kdt: tempCookies['kdt'],
|
|
356
|
+
twid: tempCookies['twid'],
|
|
357
|
+
ct0: tempCookies['ct0'],
|
|
358
|
+
auth_token: tempCookies['auth_token']
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Login to Twitter using the given credentials and get back the cookies.
|
|
363
|
+
*
|
|
364
|
+
* @public
|
|
365
|
+
*
|
|
366
|
+
* @param email The email of the account to be logged into.
|
|
367
|
+
* @param userName The username associated with the given account.
|
|
368
|
+
* @param password The password to the account.
|
|
369
|
+
*
|
|
370
|
+
* @returns The cookies for authenticating with the given account.
|
|
371
|
+
*/
|
|
372
|
+
AccountService.prototype.login = function (email, userName, password) {
|
|
373
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
374
|
+
var parsedCookies;
|
|
375
|
+
return __generator(this, function (_a) {
|
|
376
|
+
switch (_a.label) {
|
|
377
|
+
case 0:
|
|
378
|
+
// Setting user credentials
|
|
379
|
+
this.email = email;
|
|
380
|
+
this.userName = userName;
|
|
381
|
+
this.password = password;
|
|
382
|
+
// Initiating login
|
|
383
|
+
/**
|
|
384
|
+
* This works by sending a chain of request that are required for login to twitter.
|
|
385
|
+
* Each method in the chain returns a flow token that must be provied as payload in the next method in the chain.
|
|
386
|
+
* Each such method is called a subtask.
|
|
387
|
+
* Each subtask sets the {@link flowToken} property of the class which is used in the payload of the next subtask.
|
|
388
|
+
* The final subtask returns the headers which actually contains the cookie in the 'set-cookie' field.
|
|
389
|
+
*/
|
|
390
|
+
return [4 /*yield*/, this.initiateLogin()];
|
|
391
|
+
case 1:
|
|
392
|
+
// Initiating login
|
|
393
|
+
/**
|
|
394
|
+
* This works by sending a chain of request that are required for login to twitter.
|
|
395
|
+
* Each method in the chain returns a flow token that must be provied as payload in the next method in the chain.
|
|
396
|
+
* Each such method is called a subtask.
|
|
397
|
+
* Each subtask sets the {@link flowToken} property of the class which is used in the payload of the next subtask.
|
|
398
|
+
* The final subtask returns the headers which actually contains the cookie in the 'set-cookie' field.
|
|
399
|
+
*/
|
|
400
|
+
_a.sent();
|
|
401
|
+
// Parsing the cookies
|
|
402
|
+
parsedCookies = this.parseCookies(this.cookies);
|
|
403
|
+
// Returning the final parsed cookies
|
|
404
|
+
return [2 /*return*/, parsedCookies];
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
};
|
|
409
|
+
return AccountService;
|
|
410
|
+
}());
|
|
411
|
+
exports.AccountService = AccountService;
|
|
392
412
|
//# sourceMappingURL=AccountService.js.map
|