rettiwt-api 1.1.2 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +32 -7
  2. package/dist/endpoints/Endpoints.d.ts +14 -0
  3. package/dist/endpoints/Endpoints.js +20 -0
  4. package/dist/endpoints/Endpoints.js.map +1 -0
  5. package/dist/endpoints/Url.d.ts +5 -0
  6. package/dist/endpoints/Url.js +12 -0
  7. package/dist/endpoints/Url.js.map +1 -0
  8. package/dist/enums/Endpoints.d.ts +25 -0
  9. package/dist/enums/Endpoints.js +31 -0
  10. package/dist/enums/Endpoints.js.map +1 -0
  11. package/dist/enums/Errors.d.ts +20 -0
  12. package/dist/enums/Errors.js +28 -0
  13. package/dist/enums/Errors.js.map +1 -0
  14. package/dist/enums/HTTP.d.ts +17 -0
  15. package/dist/enums/HTTP.js +23 -0
  16. package/dist/enums/HTTP.js.map +1 -0
  17. package/dist/graphql/enums/Errors.d.ts +20 -0
  18. package/dist/graphql/enums/Errors.js +28 -0
  19. package/dist/graphql/enums/Errors.js.map +1 -0
  20. package/dist/graphql/queries/RootQuery.js +10 -3
  21. package/dist/graphql/queries/RootQuery.js.map +1 -1
  22. package/dist/graphql/resolvers/AccountResolver.d.ts +3 -3
  23. package/dist/graphql/resolvers/AccountResolver.js.map +1 -1
  24. package/dist/graphql/resolvers/ResolverBase.d.ts +14 -3
  25. package/dist/graphql/resolvers/ResolverBase.js +13 -1
  26. package/dist/graphql/resolvers/ResolverBase.js.map +1 -1
  27. package/dist/graphql/resolvers/TweetResolver.d.ts +3 -3
  28. package/dist/graphql/resolvers/TweetResolver.js +30 -18
  29. package/dist/graphql/resolvers/TweetResolver.js.map +1 -1
  30. package/dist/graphql/resolvers/UserResolver.d.ts +4 -4
  31. package/dist/graphql/resolvers/UserResolver.js +23 -19
  32. package/dist/graphql/resolvers/UserResolver.js.map +1 -1
  33. package/dist/graphql/types/Errors.d.ts +20 -0
  34. package/dist/graphql/types/Errors.js +28 -0
  35. package/dist/graphql/types/Errors.js.map +1 -0
  36. package/dist/graphql/types/TweetTypes.js +2 -2
  37. package/dist/graphql/types/TweetTypes.js.map +1 -1
  38. package/dist/index.d.ts +31 -15
  39. package/dist/index.js +32 -17
  40. package/dist/index.js.map +1 -1
  41. package/dist/middlewares/Authentication.d.ts +0 -0
  42. package/dist/middlewares/Authentication.js +2 -0
  43. package/dist/middlewares/Authentication.js.map +1 -0
  44. package/dist/models/args/TweetFilter.d.ts +59 -0
  45. package/dist/models/args/TweetFilter.js +101 -0
  46. package/dist/models/args/TweetFilter.js.map +1 -0
  47. package/dist/models/args/TweetListArgs.d.ts +21 -0
  48. package/dist/models/args/TweetListArgs.js +54 -0
  49. package/dist/models/args/TweetListArgs.js.map +1 -0
  50. package/dist/models/args/UserListArgs.d.ts +21 -0
  51. package/dist/models/args/UserListArgs.js +54 -0
  52. package/dist/models/args/UserListArgs.js.map +1 -0
  53. package/dist/models/auth/AuthCookie.d.ts +21 -0
  54. package/dist/models/auth/AuthCookie.js +33 -0
  55. package/dist/models/auth/AuthCookie.js.map +1 -0
  56. package/dist/models/data/CursoredData.d.ts +34 -0
  57. package/dist/models/data/CursoredData.js +42 -0
  58. package/dist/models/data/CursoredData.js.map +1 -0
  59. package/dist/models/data/DataValidationError.d.ts +18 -0
  60. package/dist/models/data/DataValidationError.js +21 -0
  61. package/dist/models/data/DataValidationError.js.map +1 -0
  62. package/dist/models/data/Errors.d.ts +18 -0
  63. package/dist/models/data/Errors.js +21 -0
  64. package/dist/models/data/Errors.js.map +1 -0
  65. package/dist/models/data/Service.d.ts +33 -0
  66. package/dist/models/data/Service.js +41 -0
  67. package/dist/models/data/Service.js.map +1 -0
  68. package/dist/models/data/Tweet.d.ts +53 -0
  69. package/dist/models/data/Tweet.js +104 -0
  70. package/dist/models/data/Tweet.js.map +1 -0
  71. package/dist/models/data/User.d.ts +41 -0
  72. package/dist/models/data/User.js +32 -0
  73. package/dist/models/data/User.js.map +1 -0
  74. package/dist/models/errors/DataValidationError.d.ts +20 -0
  75. package/dist/models/errors/DataValidationError.js +23 -0
  76. package/dist/models/errors/DataValidationError.js.map +1 -0
  77. package/dist/models/query/Variables.d.ts +2 -0
  78. package/dist/models/query/Variables.js +10 -0
  79. package/dist/models/query/Variables.js.map +1 -0
  80. package/dist/requests/Url.d.ts +5 -0
  81. package/dist/requests/Url.js +12 -0
  82. package/dist/requests/Url.js.map +1 -0
  83. package/dist/server.d.ts +1 -1
  84. package/dist/server.js +9 -10
  85. package/dist/server.js.map +1 -1
  86. package/dist/services/accounts/AccountService.d.ts +6 -0
  87. package/dist/services/accounts/AccountService.js +6 -0
  88. package/dist/services/accounts/AccountService.js.map +1 -1
  89. package/dist/services/auth/AccountService.d.ts +88 -0
  90. package/dist/services/auth/AccountService.js +392 -0
  91. package/dist/services/auth/AccountService.js.map +1 -0
  92. package/dist/services/auth/AuthService.d.ts +31 -0
  93. package/dist/services/auth/AuthService.js +118 -0
  94. package/dist/services/auth/AuthService.js.map +1 -0
  95. package/dist/services/auth/LoginFlows.d.ts +77 -0
  96. package/dist/services/auth/LoginFlows.js +92 -0
  97. package/dist/services/auth/LoginFlows.js.map +1 -0
  98. package/dist/services/data/TweetService.d.ts +46 -16
  99. package/dist/services/data/TweetService.js +71 -54
  100. package/dist/services/data/TweetService.js.map +1 -1
  101. package/dist/services/data/UserService.d.ts +45 -21
  102. package/dist/services/data/UserService.js +78 -75
  103. package/dist/services/data/UserService.js.map +1 -1
  104. package/dist/services/helper/Headers.d.ts +4 -4
  105. package/dist/services/helper/Headers.js.map +1 -1
  106. package/dist/services/helper/Parser.d.ts +2 -2
  107. package/dist/services/helper/Parser.js.map +1 -1
  108. package/dist/services/helper/extractors/Tweets.d.ts +6 -6
  109. package/dist/services/helper/extractors/Tweets.js +1 -1
  110. package/dist/services/helper/extractors/Tweets.js.map +1 -1
  111. package/dist/services/helper/extractors/Users.d.ts +4 -4
  112. package/dist/services/helper/extractors/Users.js +1 -1
  113. package/dist/services/helper/extractors/Users.js.map +1 -1
  114. package/dist/services/helper/payloads/LoginFlows.d.ts +77 -0
  115. package/dist/services/helper/payloads/LoginFlows.js +92 -0
  116. package/dist/services/helper/payloads/LoginFlows.js.map +1 -0
  117. package/dist/services/util/CacheService.d.ts +33 -0
  118. package/dist/services/util/CacheService.js +96 -0
  119. package/dist/services/util/CacheService.js.map +1 -0
  120. package/dist/services/util/FetcherService.d.ts +65 -0
  121. package/dist/services/util/FetcherService.js +214 -0
  122. package/dist/services/util/FetcherService.js.map +1 -0
  123. package/dist/types/Args.d.ts +38 -0
  124. package/dist/types/Args.js +5 -0
  125. package/dist/types/Args.js.map +1 -0
  126. package/dist/types/Authentication.d.ts +17 -2
  127. package/dist/types/Authentication.js +1 -0
  128. package/dist/types/Authentication.js.map +1 -1
  129. package/dist/types/Resolvers.d.ts +5 -4
  130. package/dist/types/Rettiwt.d.ts +16 -0
  131. package/dist/types/Rettiwt.js +3 -0
  132. package/dist/types/Rettiwt.js.map +1 -0
  133. package/dist/types/Service.d.ts +15 -23
  134. package/dist/types/Service.js +2 -16
  135. package/dist/types/Service.js.map +1 -1
  136. package/dist/types/Tweet.d.ts +25 -19
  137. package/dist/types/Tweet.js +0 -2
  138. package/dist/types/Tweet.js.map +1 -1
  139. package/dist/types/User.d.ts +35 -0
  140. package/dist/types/User.js +3 -0
  141. package/dist/types/User.js.map +1 -0
  142. package/dist/types/args/TweetFilter.d.ts +54 -0
  143. package/dist/types/args/TweetFilter.js +96 -0
  144. package/dist/types/args/TweetFilter.js.map +1 -0
  145. package/dist/types/args/TweetListArg.d.ts +10 -0
  146. package/dist/types/args/TweetListArg.js +42 -0
  147. package/dist/types/args/TweetListArg.js.map +1 -0
  148. package/dist/types/args/TweetListArgs.d.ts +20 -0
  149. package/dist/types/args/TweetListArgs.js +52 -0
  150. package/dist/types/args/TweetListArgs.js.map +1 -0
  151. package/dist/types/args/UserListArgs.d.ts +16 -0
  152. package/dist/types/args/UserListArgs.js +48 -0
  153. package/dist/types/args/UserListArgs.js.map +1 -0
  154. package/dist/types/data/TweetFilter.d.ts +49 -0
  155. package/dist/types/data/TweetFilter.js +63 -0
  156. package/dist/types/data/TweetFilter.js.map +1 -0
  157. package/dist/types/interfaces/Args.d.ts +38 -0
  158. package/dist/types/interfaces/Args.js +5 -0
  159. package/dist/types/interfaces/Args.js.map +1 -0
  160. package/dist/types/interfaces/Authentication.d.ts +40 -0
  161. package/dist/types/interfaces/Authentication.js +5 -0
  162. package/dist/types/interfaces/Authentication.js.map +1 -0
  163. package/dist/types/interfaces/Resolvers.d.ts +14 -0
  164. package/dist/types/interfaces/Resolvers.js +3 -0
  165. package/dist/types/interfaces/Resolvers.js.map +1 -0
  166. package/dist/types/interfaces/Rettiwt.d.ts +16 -0
  167. package/dist/types/interfaces/Rettiwt.js +3 -0
  168. package/dist/types/interfaces/Rettiwt.js.map +1 -0
  169. package/dist/types/interfaces/Service.d.ts +13 -0
  170. package/dist/types/interfaces/Service.js +3 -0
  171. package/dist/types/interfaces/Service.js.map +1 -0
  172. package/dist/types/interfaces/Services.d.ts +13 -0
  173. package/dist/types/interfaces/Services.js +3 -0
  174. package/dist/types/interfaces/Services.js.map +1 -0
  175. package/dist/types/interfaces/Tweet.d.ts +46 -0
  176. package/dist/types/interfaces/Tweet.js +3 -0
  177. package/dist/types/interfaces/Tweet.js.map +1 -0
  178. package/dist/types/interfaces/TweetFilter.d.ts +0 -0
  179. package/dist/types/interfaces/TweetFilter.js +2 -0
  180. package/dist/types/interfaces/TweetFilter.js.map +1 -0
  181. package/{src/types/data/User.ts → dist/types/interfaces/User.d.ts} +35 -51
  182. package/dist/types/interfaces/User.js +3 -0
  183. package/dist/types/interfaces/User.js.map +1 -0
  184. package/dist/types/raw/query/tweet/TweetDetails.d.ts +34 -0
  185. package/dist/types/raw/query/tweet/TweetDetails.js +5 -0
  186. package/dist/types/raw/query/tweet/TweetDetails.js.map +1 -0
  187. package/dist/types/raw/user/User.js.map +1 -1
  188. package/dist/types/services/args/TweetFilter.d.ts +50 -0
  189. package/dist/types/services/args/TweetFilter.js +76 -0
  190. package/dist/types/services/args/TweetFilter.js.map +1 -0
  191. package/docs/.nojekyll +1 -0
  192. package/docs/assets/highlight.css +64 -0
  193. package/docs/assets/main.js +58 -0
  194. package/docs/assets/search.js +1 -0
  195. package/docs/assets/style.css +1280 -0
  196. package/docs/classes/AccountService.html +303 -0
  197. package/docs/classes/AuthCookie.html +146 -0
  198. package/docs/classes/AuthService.html +147 -0
  199. package/docs/classes/CacheService.html +157 -0
  200. package/docs/classes/Cursor.html +102 -0
  201. package/docs/classes/CursoredData.html +126 -0
  202. package/docs/classes/DataValidationError.html +119 -0
  203. package/docs/classes/FetcherService.html +225 -0
  204. package/docs/classes/Tweet.html +210 -0
  205. package/docs/classes/TweetEntities.html +128 -0
  206. package/docs/classes/TweetFilter.html +204 -0
  207. package/docs/classes/TweetListArgs.html +118 -0
  208. package/docs/classes/TweetService.html +313 -0
  209. package/docs/classes/User.html +230 -0
  210. package/docs/classes/UserListArgs.html +118 -0
  211. package/docs/classes/UserService.html +315 -0
  212. package/docs/enums/HttpMethods.html +74 -0
  213. package/docs/functions/Rettiwt.html +99 -0
  214. package/docs/index.html +161 -0
  215. package/docs/interfaces/IAuthCookie.html +104 -0
  216. package/docs/interfaces/ICursor.html +77 -0
  217. package/docs/interfaces/ICursoredData.html +93 -0
  218. package/docs/interfaces/IDataContext.html +91 -0
  219. package/docs/interfaces/IListArgs.html +87 -0
  220. package/docs/interfaces/ITweet.html +176 -0
  221. package/docs/interfaces/ITweetEntities.html +104 -0
  222. package/docs/interfaces/ITweetFilter.html +158 -0
  223. package/docs/interfaces/IUser.html +194 -0
  224. package/docs/modules.html +109 -0
  225. package/package.json +5 -2
  226. package/src/enums/Errors.ts +21 -0
  227. package/src/graphql/enums/Errors.ts +21 -0
  228. package/src/graphql/queries/RootQuery.ts +11 -4
  229. package/src/graphql/resolvers/AccountResolver.ts +3 -3
  230. package/src/graphql/resolvers/ResolverBase.ts +19 -5
  231. package/src/graphql/resolvers/TweetResolver.ts +26 -17
  232. package/src/graphql/resolvers/UserResolver.ts +18 -20
  233. package/src/graphql/types/TweetTypes.ts +2 -2
  234. package/src/graphql/types/UserTypes.ts +1 -1
  235. package/src/index.ts +39 -17
  236. package/src/models/args/TweetFilter.ts +119 -0
  237. package/src/models/args/TweetListArgs.ts +47 -0
  238. package/src/models/args/UserListArgs.ts +47 -0
  239. package/src/models/auth/AuthCookie.ts +43 -0
  240. package/src/models/data/CursoredData.ts +45 -0
  241. package/src/models/data/Tweet.ts +118 -0
  242. package/src/models/data/User.ts +72 -0
  243. package/src/models/errors/DataValidationError.ts +29 -0
  244. package/src/server.ts +9 -10
  245. package/src/services/{accounts → auth}/AccountService.ts +71 -19
  246. package/src/services/auth/AuthService.ts +81 -0
  247. package/src/services/data/TweetService.ts +77 -58
  248. package/src/services/data/UserService.ts +93 -89
  249. package/src/services/helper/Headers.ts +4 -4
  250. package/src/services/helper/Parser.ts +2 -2
  251. package/src/services/helper/extractors/Tweets.ts +7 -7
  252. package/src/services/helper/extractors/Users.ts +5 -5
  253. package/src/services/{CacheService.ts → util/CacheService.ts} +4 -1
  254. package/src/services/{FetcherService.ts → util/FetcherService.ts} +19 -11
  255. package/src/types/Args.ts +49 -0
  256. package/src/types/Authentication.ts +29 -7
  257. package/src/types/Resolvers.ts +5 -4
  258. package/src/types/Rettiwt.ts +20 -0
  259. package/src/types/Service.ts +24 -0
  260. package/src/types/Tweet.ts +61 -0
  261. package/src/types/User.ts +48 -0
  262. package/tsconfig.json +2 -2
  263. package/src/services/AuthService.ts +0 -68
  264. package/src/services/helper/deserializers/Tweets.ts +0 -70
  265. package/src/services/helper/deserializers/Users.ts +0 -26
  266. package/src/types/data/Errors.ts +0 -37
  267. package/src/types/data/Service.ts +0 -55
  268. package/src/types/data/Tweet.ts +0 -123
  269. package/src/types/raw/auth/Cookie.ts +0 -16
  270. /package/src/{types → enums}/HTTP.ts +0 -0
  271. /package/src/services/{accounts → helper/payloads}/LoginFlows.ts +0 -0
package/README.md CHANGED
@@ -13,7 +13,7 @@ An API for fetching data from TwitterAPI, without any rate limits!
13
13
  Using the API as a GraphQL enables complex nested queries to fetch data from twitter.
14
14
  To use the API as a server,
15
15
 
16
- 1. Clone the repo
16
+ 1. Clone the repo's release branch
17
17
  2. Build the project using 'npm run build'
18
18
  3. Set the environment variables:
19
19
  - APP_PORT -> The port number where the server will listen to
@@ -31,17 +31,42 @@ To use the API as an npm package,
31
31
 
32
32
  1. In your node project, install the package using 'npm install --save rettiwt-api'.
33
33
  2. import { Rettiwt } from 'rettiwt-api'.
34
- 3. const rettiwt = Rettiwt().
35
- 4. Use the created [Rettiwt](https://rishikant181.github.io/Rettiwt-API/functions/Rettiwt.html) instance to fetch data from Twitter.
34
+ const rettiwt = Rettiwt().
35
+ 3. Use the created [Rettiwt](https://rishikant181.github.io/Rettiwt-API/functions/Rettiwt.html) instance to fetch data from Twitter.
36
36
 
37
37
  This creates an instance of Rettiwt which can be used to fetch data from Twitter. This instance works as guest and no form of authentication is used. However, guest mode implies functionalities such fetching of user followings, followers, likes and tweet likes, retweets, quotes and replies is not possible. Whatever data can be viewed in Twitter without loggin in, can be accessed this way.
38
38
 
39
- If you wan't full functionality, you need to use the cookie of a logged in Twitter account, which can be retrieved from the browser.
39
+ If you wan't full functionality, you need to use the cookie of a logged in Twitter account, which can be retrieved in the following way:
40
40
 
41
- - For GraphQL Server mode, you can get the cookie using the Login query and pass the received cookie-string in the header while making a request to the graphql server
42
- - For npm library mode, you can get the cookie using the Rettiwt().account.login method and pass the received cookie-string to the constructor while creating instance of Rettiwt
41
+ #### A. GraphQL Server:
42
+ 1. Make the following query to the GraphQL server:
43
+ ```
44
+ query {
45
+ Login(email: "your_twitter_email", userName: "your_twitter_username", password: "your_twitter_password") {
46
+ auth_token
47
+ ct0
48
+ kdt
49
+ twid
50
+ }
51
+ }
52
+ ```
53
+ 1. This will give you 4 tokens: 'auth_token', 'ct0', 'kdt' and 'twid'.
54
+ 2. Pass the four tokens in the headers while making any request made to the GraphQL server for fetching data.
55
+
56
+ #### B. NPM Library:
57
+ 1. Use the [Rettiwt().account.login](https://rishikant181.github.io/Rettiwt-API/classes/AccountService.html#login) method to get back 4 tokens: 'auth_token', 'ct0', 'kdt' and 'twid'.
58
+ 2. Use these four tokens to initialize a new [Rettiwt](https://rishikant181.github.io/Rettiwt-API/functions/Rettiwt.html) instance as follows:
59
+ ```
60
+ const rettiwt = new Rettiwt({
61
+ auth_token: "received_auth_token",
62
+ ct0: "received_ct0_token",
63
+ kdt: "received_kdt_token",
64
+ twid: "received_twid_token"
65
+ });
66
+ ```
67
+ 3. Use the created [Rettiwt](https://rishikant181.github.io/Rettiwt-API/functions/Rettiwt.html) instance to fetch data.
43
68
 
44
69
  ### **If you don't want to risk your twitter account getting banned, using cookies is completely optional and you can omit passing cookie and use the API as guest**
45
70
  ### **No likes, followers, followings, retweets, replies, tweet likes, quotes can be fetched without using cookie!**
46
71
  ### **It's completely safe to use the API as a guest and not using cookies, since that way, no form of authentication is used**
47
- ### **If you decide to use cookies for full functionality, I'M NOT RESPONSIBLE IF YOU GET YOU TWITTER ACCOUNT BANNED!**
72
+ ### **If you decide to use cookies for full functionality, I'M NOT RESPONSIBLE IF YOU GET YOUR TWITTER ACCOUNT BANNED!**
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The different endpoints for detching data from Twitter.
3
+ */
4
+ export declare enum Endpoints {
5
+ TweetDetails = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail",
6
+ TweetLikes = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters",
7
+ TweetRetweets = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters",
8
+ TweetSearch = "/2/search/adaptive.json",
9
+ UserDetails = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName",
10
+ UserDetailsById = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId",
11
+ UserFollowing = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following",
12
+ UserFollowers = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers",
13
+ UserLikes = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes"
14
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Endpoints = void 0;
4
+ /**
5
+ * The different endpoints for detching data from Twitter.
6
+ */
7
+ var Endpoints;
8
+ (function (Endpoints) {
9
+ Endpoints["TweetDetails"] = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail";
10
+ Endpoints["TweetLikes"] = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters";
11
+ Endpoints["TweetRetweets"] = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters";
12
+ Endpoints["TweetSearch"] = "/2/search/adaptive.json";
13
+ Endpoints["UserDetails"] = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName";
14
+ Endpoints["UserDetailsById"] = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId";
15
+ Endpoints["UserFollowing"] = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following";
16
+ Endpoints["UserFollowers"] = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers";
17
+ Endpoints["UserLikes"] = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes";
18
+ })(Endpoints = exports.Endpoints || (exports.Endpoints = {}));
19
+ ;
20
+ //# sourceMappingURL=Endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Endpoints.js","sourceRoot":"","sources":["../../src/endpoints/Endpoints.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,SAUX;AAVD,WAAY,SAAS;IACjB,yEAA4D,CAAA;IAC5D,sEAAyD,CAAA;IACzD,yEAA4D,CAAA;IAC5D,oDAAuC,CAAA;IACvC,6EAAgE,CAAA;IAChE,6EAAgE,CAAA;IAChE,wEAA2D,CAAA;IAC3D,wEAA2D,CAAA;IAC3D,gEAAmD,CAAA;AACvD,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB;AAAA,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class Url {
2
+ /** The base Twitter API url. */
3
+ base: string;
4
+ constructor();
5
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Url = void 0;
4
+ var Url = /** @class */ (function () {
5
+ function Url() {
6
+ /** The base Twitter API url. */
7
+ this.base = 'https://api.twitter.com';
8
+ }
9
+ return Url;
10
+ }());
11
+ exports.Url = Url;
12
+ //# sourceMappingURL=Url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Url.js","sourceRoot":"","sources":["../../src/endpoints/Url.ts"],"names":[],"mappings":";;;AAAA;IAII;QAHA,gCAAgC;QAChC,SAAI,GAAW,yBAAyB,CAAC;IAIzC,CAAC;IACL,UAAC;AAAD,CAAC,AAPD,IAOC;AAPY,kBAAG"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The different endpoints for detching data from Twitter.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare enum Endpoints {
7
+ /** The endpoint for fetching the details of a Tweet with the given id. */
8
+ TweetDetails = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail",
9
+ /** The endpoint for fetching the list of likers of a Tweet with the given id. */
10
+ TweetLikes = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters",
11
+ /** The endpoint for fetching the list of retweeters of a Tweet with the given id. */
12
+ TweetRetweets = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters",
13
+ /** The endpoint for searching for Tweets matching the given filter/query. */
14
+ TweetSearch = "/2/search/adaptive.json",
15
+ /** The endpoint for fetching the details of a User with the given username. */
16
+ UserDetails = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName",
17
+ /** The endpoint for fetching the details of a User with the given id. */
18
+ UserDetailsById = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId",
19
+ /** The endpoint for fetching the list of following of a User with the given id. */
20
+ UserFollowing = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following",
21
+ /** The endpoint for fetching the list of followers of a User with the given id. */
22
+ UserFollowers = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers",
23
+ /** The endpoint for fetching the list of tweets liked by the User with the given id. */
24
+ UserLikes = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes"
25
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Endpoints = void 0;
4
+ /**
5
+ * The different endpoints for detching data from Twitter.
6
+ *
7
+ * @internal
8
+ */
9
+ var Endpoints;
10
+ (function (Endpoints) {
11
+ /** The endpoint for fetching the details of a Tweet with the given id. */
12
+ Endpoints["TweetDetails"] = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail";
13
+ /** The endpoint for fetching the list of likers of a Tweet with the given id. */
14
+ Endpoints["TweetLikes"] = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters";
15
+ /** The endpoint for fetching the list of retweeters of a Tweet with the given id. */
16
+ Endpoints["TweetRetweets"] = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters";
17
+ /** The endpoint for searching for Tweets matching the given filter/query. */
18
+ Endpoints["TweetSearch"] = "/2/search/adaptive.json";
19
+ /** The endpoint for fetching the details of a User with the given username. */
20
+ Endpoints["UserDetails"] = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName";
21
+ /** The endpoint for fetching the details of a User with the given id. */
22
+ Endpoints["UserDetailsById"] = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId";
23
+ /** The endpoint for fetching the list of following of a User with the given id. */
24
+ Endpoints["UserFollowing"] = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following";
25
+ /** The endpoint for fetching the list of followers of a User with the given id. */
26
+ Endpoints["UserFollowers"] = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers";
27
+ /** The endpoint for fetching the list of tweets liked by the User with the given id. */
28
+ Endpoints["UserLikes"] = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes";
29
+ })(Endpoints = exports.Endpoints || (exports.Endpoints = {}));
30
+ ;
31
+ //# sourceMappingURL=Endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Endpoints.js","sourceRoot":"","sources":["../../src/enums/Endpoints.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,SA2BX;AA3BD,WAAY,SAAS;IACjB,0EAA0E;IAC1E,yEAA4D,CAAA;IAE5D,iFAAiF;IACjF,sEAAyD,CAAA;IAEzD,qFAAqF;IACrF,yEAA4D,CAAA;IAE5D,6EAA6E;IAC7E,oDAAuC,CAAA;IAEvC,+EAA+E;IAC/E,6EAAgE,CAAA;IAEhE,yEAAyE;IACzE,6EAAgE,CAAA;IAEhE,mFAAmF;IACnF,wEAA2D,CAAA;IAE3D,mFAAmF;IACnF,wEAA2D,CAAA;IAE3D,wFAAwF;IACxF,gEAAmD,CAAA;AACvD,CAAC,EA3BW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA2BpB;AAAA,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Different types of error messages related to authentication returned by services.
3
+ *
4
+ * @public
5
+ */
6
+ export declare enum AuthenticationErrors {
7
+ NotAuthenticated = "Cannot fetch this data without authentication",
8
+ InvalidEmail = "No Twitter account found for the given email address",
9
+ InvalidUsername = "Incorrect username given for the given Twitter account",
10
+ InvalidPassword = "Incorrect password given for the given Twitter account"
11
+ }
12
+ /**
13
+ * Different type of error messages related to data that are returned by services.
14
+ *
15
+ * @public
16
+ */
17
+ export declare enum DataErrors {
18
+ UserNotFound = "An account with given username/id was not found",
19
+ TweetNotFound = "A tweet with the given id was not found"
20
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.DataErrors = exports.AuthenticationErrors = void 0;
4
+ /**
5
+ * Different types of error messages related to authentication returned by services.
6
+ *
7
+ * @public
8
+ */
9
+ var AuthenticationErrors;
10
+ (function (AuthenticationErrors) {
11
+ AuthenticationErrors["NotAuthenticated"] = "Cannot fetch this data without authentication";
12
+ AuthenticationErrors["InvalidEmail"] = "No Twitter account found for the given email address";
13
+ AuthenticationErrors["InvalidUsername"] = "Incorrect username given for the given Twitter account";
14
+ AuthenticationErrors["InvalidPassword"] = "Incorrect password given for the given Twitter account";
15
+ })(AuthenticationErrors = exports.AuthenticationErrors || (exports.AuthenticationErrors = {}));
16
+ ;
17
+ /**
18
+ * Different type of error messages related to data that are returned by services.
19
+ *
20
+ * @public
21
+ */
22
+ var DataErrors;
23
+ (function (DataErrors) {
24
+ DataErrors["UserNotFound"] = "An account with given username/id was not found";
25
+ DataErrors["TweetNotFound"] = "A tweet with the given id was not found";
26
+ })(DataErrors = exports.DataErrors || (exports.DataErrors = {}));
27
+ ;
28
+ //# sourceMappingURL=Errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../src/enums/Errors.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,0FAAkE,CAAA;IAClE,6FAAqE,CAAA;IACrE,kGAA0E,CAAA;IAC1E,kGAA0E,CAAA;AAC9E,CAAC,EALW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAK/B;AAAA,CAAC;AAEF;;;;GAIG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,8EAAgE,CAAA;IAChE,uEAAyD,CAAA;AAC7D,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB;AAAA,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The different types of http status codes
3
+ *
4
+ * @internal
5
+ */
6
+ export declare enum HttpStatus {
7
+ BadRequest = 400,
8
+ Unauthorized = 401,
9
+ Forbidden = 403,
10
+ NotFound = 404,
11
+ MethodNotAllowed = 405,
12
+ RequestTimeout = 408,
13
+ TooManyRequests = 429,
14
+ InternalServerError = 500,
15
+ BadGateway = 502,
16
+ ServiceUnavailable = 503
17
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.HttpStatus = void 0;
4
+ /**
5
+ * The different types of http status codes
6
+ *
7
+ * @internal
8
+ */
9
+ var HttpStatus;
10
+ (function (HttpStatus) {
11
+ HttpStatus[HttpStatus["BadRequest"] = 400] = "BadRequest";
12
+ HttpStatus[HttpStatus["Unauthorized"] = 401] = "Unauthorized";
13
+ HttpStatus[HttpStatus["Forbidden"] = 403] = "Forbidden";
14
+ HttpStatus[HttpStatus["NotFound"] = 404] = "NotFound";
15
+ HttpStatus[HttpStatus["MethodNotAllowed"] = 405] = "MethodNotAllowed";
16
+ HttpStatus[HttpStatus["RequestTimeout"] = 408] = "RequestTimeout";
17
+ HttpStatus[HttpStatus["TooManyRequests"] = 429] = "TooManyRequests";
18
+ HttpStatus[HttpStatus["InternalServerError"] = 500] = "InternalServerError";
19
+ HttpStatus[HttpStatus["BadGateway"] = 502] = "BadGateway";
20
+ HttpStatus[HttpStatus["ServiceUnavailable"] = 503] = "ServiceUnavailable";
21
+ })(HttpStatus = exports.HttpStatus || (exports.HttpStatus = {}));
22
+ ;
23
+ //# sourceMappingURL=HTTP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTTP.js","sourceRoot":"","sources":["../../src/enums/HTTP.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,UAWX;AAXD,WAAY,UAAU;IAClB,yDAAgB,CAAA;IAChB,6DAAkB,CAAA;IAClB,uDAAe,CAAA;IACf,qDAAc,CAAA;IACd,qEAAsB,CAAA;IACtB,iEAAoB,CAAA;IACpB,mEAAqB,CAAA;IACrB,2EAAyB,CAAA;IACzB,yDAAgB,CAAA;IAChB,yEAAwB,CAAA;AAC5B,CAAC,EAXW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAWrB;AAAA,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Different types error messages for validation errors returned by GraphQL API.
3
+ *
4
+ * @public
5
+ */
6
+ export declare enum ValidationErrors {
7
+ NoUserIdentification = "Either userName or id must be given"
8
+ }
9
+ /**
10
+ * Different type of error messages related to data that are returned by GraphQL API.
11
+ *
12
+ * @public
13
+ */
14
+ export declare enum DataErrors {
15
+ NoTweetsFound = "No tweets matching the given criteria found",
16
+ NoLikersFound = "No likers found for the tweet with the given id",
17
+ NoRetweetersFound = "No retweeters found for the tweet with the given id",
18
+ NoFollowsFound = "No follow details were found for the user with the given id",
19
+ NoLikedTweetsFound = "No liked tweets were found for the user with the given id"
20
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.DataErrors = exports.ValidationErrors = void 0;
4
+ /**
5
+ * Different types error messages for validation errors returned by GraphQL API.
6
+ *
7
+ * @public
8
+ */
9
+ var ValidationErrors;
10
+ (function (ValidationErrors) {
11
+ ValidationErrors["NoUserIdentification"] = "Either userName or id must be given";
12
+ })(ValidationErrors = exports.ValidationErrors || (exports.ValidationErrors = {}));
13
+ ;
14
+ /**
15
+ * Different type of error messages related to data that are returned by GraphQL API.
16
+ *
17
+ * @public
18
+ */
19
+ var DataErrors;
20
+ (function (DataErrors) {
21
+ DataErrors["NoTweetsFound"] = "No tweets matching the given criteria found";
22
+ DataErrors["NoLikersFound"] = "No likers found for the tweet with the given id";
23
+ DataErrors["NoRetweetersFound"] = "No retweeters found for the tweet with the given id";
24
+ DataErrors["NoFollowsFound"] = "No follow details were found for the user with the given id";
25
+ DataErrors["NoLikedTweetsFound"] = "No liked tweets were found for the user with the given id";
26
+ })(DataErrors = exports.DataErrors || (exports.DataErrors = {}));
27
+ ;
28
+ //# sourceMappingURL=Errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../../src/graphql/enums/Errors.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IACxB,gFAA4D,CAAA;AAChE,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B;AAAA,CAAC;AAEF;;;;GAIG;AACH,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,2EAA6D,CAAA;IAC7D,+EAAiE,CAAA;IACjE,uFAAyE,CAAA;IACzE,4FAA8E,CAAA;IAC9E,8FAAgF,CAAA;AACpF,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB;AAAA,CAAC"}
@@ -24,10 +24,9 @@ exports.rootQuery = new graphql_1.GraphQLObjectType({
24
24
  type: UserTypes_1.User,
25
25
  description: "Returns the details of the twitter user with given user name",
26
26
  args: {
27
- userName: { type: graphql_1.GraphQLString },
28
27
  id: { type: graphql_1.GraphQLString }
29
28
  },
30
- resolve: function (parent, args, context) { return new UserResolver_1["default"](context).resolveUserDetails(args.userName, args.id); }
29
+ resolve: function (parent, args, context) { return new UserResolver_1["default"](context).resolveUserDetails(args.id); }
31
30
  },
32
31
  Tweet: {
33
32
  type: TweetTypes_1.Tweet,
@@ -57,7 +56,15 @@ exports.rootQuery = new graphql_1.GraphQLObjectType({
57
56
  resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweets(args, args.count, args.cursor); }
58
57
  },
59
58
  Login: {
60
- type: graphql_1.GraphQLString,
59
+ type: new graphql_1.GraphQLObjectType({
60
+ name: 'AuthCookie',
61
+ fields: {
62
+ auth_token: { type: graphql_1.GraphQLString },
63
+ ct0: { type: graphql_1.GraphQLString },
64
+ kdt: { type: graphql_1.GraphQLString },
65
+ twid: { type: graphql_1.GraphQLString }
66
+ }
67
+ }),
61
68
  description: "Returns the cookies that can be used to fetch data from twitter",
62
69
  args: {
63
70
  email: { type: graphql_1.GraphQLString },
@@ -1 +1 @@
1
- {"version":3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AAE,IAAI,EAAE,uBAAa,EAAE;oBAC5B,GAAG,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;oBAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;iBAChC;aACJ,CAAC;YACF,WAAW,EAAE,iEAAiE;YAC9E,IAAI,EAAE;gBACF,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;gBAC9B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;gBACjC,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;aACpC;YACD,OAAO,EAAE,UAAC,MAAM,EAAE,IAAI,EAAE,OAAO,IAAK,OAAA,IAAI,4BAAe,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAnF,CAAmF;SAC1H;KACJ;CACJ,CAAC,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import ResolverBase from './ResolverBase';
2
- import { DataContext } from '../../types/data/Service';
2
+ import { IDataContext } from '../../types/Rettiwt';
3
3
  export default class AccountResolver extends ResolverBase {
4
- constructor(context: DataContext);
4
+ constructor(context: IDataContext);
5
5
  /**
6
6
  * @param email The email of the account to be logged into
7
7
  * @param userName The username associated with the account
8
8
  * @param password The password to the account
9
9
  * @returns The cookie string that can be used to authenticate against twitter
10
10
  */
11
- resolveLogin(email: string, userName: string, password: string): Promise<string>;
11
+ resolveLogin(email: string, userName: string, password: string): Promise<any>;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AccountResolver.js","sourceRoot":"","sources":["../../../src/graphql/resolvers/AccountResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,gEAA0C;AAK1C;IAA6C,mCAAY;IACrD,iBAAiB;IACjB,yBAAY,OAAoB;eAC5B,kBAAM,OAAO,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACG,sCAAY,GAAlB,UAAmB,KAAa,EAAE,QAAgB,EAAE,QAAgB;;;;4BACzD,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAA;4BAAlE,sBAAO,SAA2D,EAAC;;;;KACtE;IACL,sBAAC;AAAD,CAAC,AAfD,CAA6C,yBAAY,GAexD"}
1
+ {"version":3,"file":"AccountResolver.js","sourceRoot":"","sources":["../../../src/graphql/resolvers/AccountResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,gEAA0C;AAK1C;IAA6C,mCAAY;IACrD,iBAAiB;IACjB,yBAAY,OAAqB;eAC7B,kBAAM,OAAO,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACG,sCAAY,GAAlB,UAAmB,KAAa,EAAE,QAAgB,EAAE,QAAgB;;;;4BACzD,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAA;4BAAlE,sBAAO,SAA2D,EAAC;;;;KACtE;IACL,sBAAC;AAAD,CAAC,AAfD,CAA6C,yBAAY,GAexD"}
@@ -1,5 +1,16 @@
1
- import { DataContext } from '../../types/data/Service';
1
+ import { GraphQLError } from 'graphql';
2
+ import { IDataContext } from '../../types/Rettiwt';
2
3
  export default class ResolverBase {
3
- protected context: DataContext;
4
- constructor(context: DataContext);
4
+ /** The current data context that can used for fetching data from Twitter. */
5
+ protected context: IDataContext;
6
+ /**
7
+ * @param context The data context that will be used for fetching data from Twitter.
8
+ */
9
+ constructor(context: IDataContext);
10
+ /**
11
+ * @param error The error object received from the services.
12
+ *
13
+ * @returns The GraphQL error object that can be returned to the client.
14
+ */
15
+ protected getGraphQLError(error: Error): GraphQLError;
5
16
  }
@@ -1,10 +1,22 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
+ // PACKAGES
4
+ var graphql_1 = require("graphql");
3
5
  var ResolverBase = /** @class */ (function () {
4
- // MEMBER METHODS
6
+ /**
7
+ * @param context The data context that will be used for fetching data from Twitter.
8
+ */
5
9
  function ResolverBase(context) {
6
10
  this.context = context;
7
11
  }
12
+ /**
13
+ * @param error The error object received from the services.
14
+ *
15
+ * @returns The GraphQL error object that can be returned to the client.
16
+ */
17
+ ResolverBase.prototype.getGraphQLError = function (error) {
18
+ return new graphql_1.GraphQLError(error.message, undefined, undefined, undefined, undefined, undefined, error);
19
+ };
8
20
  return ResolverBase;
9
21
  }());
10
22
  exports["default"] = ResolverBase;
@@ -1 +1 @@
1
- {"version":3,"file":"ResolverBase.js","sourceRoot":"","sources":["../../../src/graphql/resolvers/ResolverBase.ts"],"names":[],"mappings":";;AAGA;IAII,iBAAiB;IACjB,sBAAY,OAAoB;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IACL,mBAAC;AAAD,CAAC,AARD,IAQC"}
1
+ {"version":3,"file":"ResolverBase.js","sourceRoot":"","sources":["../../../src/graphql/resolvers/ResolverBase.ts"],"names":[],"mappings":";;AAAA,WAAW;AACX,mCAAsC;AAKtC;IAII;;OAEG;IACH,sBAAY,OAAqB;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACO,sCAAe,GAAzB,UAA0B,KAAY;QAClC,OAAO,IAAI,sBAAY,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACzG,CAAC;IACL,mBAAC;AAAD,CAAC,AAnBD,IAmBC"}
@@ -1,9 +1,9 @@
1
1
  import ResolverBase from './ResolverBase';
2
- import { TweetFilter } from '../../types/data/Tweet';
3
- import { DataContext } from '../../types/data/Service';
2
+ import { IDataContext } from '../../types/Rettiwt';
3
+ import { TweetFilter } from '../../models/args/TweetFilter';
4
4
  export default class TweetResolver extends ResolverBase {
5
5
  private batchSize;
6
- constructor(context: DataContext);
6
+ constructor(context: IDataContext);
7
7
  /**
8
8
  * @returns The details of the tweet with the given id
9
9
  * @param id The id of the tweet which is to be fetched
@@ -56,14 +56,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
56
56
  exports.__esModule = true;
57
57
  // RESOLVERS
58
58
  var ResolverBase_1 = __importDefault(require("./ResolverBase"));
59
- var Service_1 = require("../../types/data/Service");
60
- var Errors_1 = require("../../types/data/Errors");
59
+ var CursoredData_1 = require("../../models/data/CursoredData");
60
+ var Errors_1 = require("../enums/Errors");
61
61
  var TweetResolver = /** @class */ (function (_super) {
62
62
  __extends(TweetResolver, _super);
63
63
  // MEMBER METHODS
64
64
  function TweetResolver(context) {
65
65
  var _this = _super.call(this, context) || this;
66
- _this.batchSize = 20;
66
+ _this.batchSize = 100;
67
67
  return _this;
68
68
  }
69
69
  /**
@@ -73,9 +73,12 @@ var TweetResolver = /** @class */ (function (_super) {
73
73
  TweetResolver.prototype.resolveTweet = function (id) {
74
74
  return __awaiter(this, void 0, void 0, function () {
75
75
  var res;
76
+ var _this = this;
76
77
  return __generator(this, function (_a) {
77
78
  switch (_a.label) {
78
- case 0: return [4 /*yield*/, this.context.tweets.getTweetById(id)];
79
+ case 0: return [4 /*yield*/, this.context.tweets.getTweetDetails(id)["catch"](function (error) {
80
+ throw _this.getGraphQLError(error);
81
+ })];
79
82
  case 1:
80
83
  res = _a.sent();
81
84
  // Evaluating response
@@ -93,24 +96,24 @@ var TweetResolver = /** @class */ (function (_super) {
93
96
  TweetResolver.prototype.resolveTweets = function (filter, count, cursor) {
94
97
  var _a;
95
98
  return __awaiter(this, void 0, void 0, function () {
96
- var tweets, next, total, res;
99
+ var tweets, next, total, batchSize, res;
100
+ var _this = this;
97
101
  return __generator(this, function (_b) {
98
102
  switch (_b.label) {
99
103
  case 0:
100
104
  tweets = [];
101
- next = new Service_1.Cursor(cursor);
105
+ next = new CursoredData_1.Cursor(cursor);
102
106
  total = 0;
103
- // Checking if the given tweet filter is valid or not
104
- if (!(filter.fromUsers || filter.toUsers || filter.words || filter.hashtags || filter.mentions || filter.quoted)) {
105
- throw new Error(Errors_1.ValidationErrors.InvalidTweetFilter);
106
- }
107
+ batchSize = 20;
107
108
  // If required count less than batch size, setting batch size to required count
108
- this.batchSize = (count < this.batchSize) ? count : this.batchSize;
109
+ batchSize = (count < batchSize) ? count : batchSize;
109
110
  _b.label = 1;
110
111
  case 1:
111
112
  // If this is the last batch, change batch size to number of remaining tweets
112
- this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
113
- return [4 /*yield*/, this.context.tweets.getTweets(filter, this.batchSize, next.value)];
113
+ batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
114
+ return [4 /*yield*/, this.context.tweets.getTweets(filter, batchSize, next.value)["catch"](function (error) {
115
+ throw _this.getGraphQLError(error);
116
+ })];
114
117
  case 2:
115
118
  res = _b.sent();
116
119
  // If data is available
@@ -153,6 +156,7 @@ var TweetResolver = /** @class */ (function (_super) {
153
156
  TweetResolver.prototype.resolveTweetQuotes = function (id, count, all, cursor, quoteCount) {
154
157
  return __awaiter(this, void 0, void 0, function () {
155
158
  var quotes, filter;
159
+ var _this = this;
156
160
  return __generator(this, function (_a) {
157
161
  switch (_a.label) {
158
162
  case 0:
@@ -169,7 +173,9 @@ var TweetResolver = /** @class */ (function (_super) {
169
173
  endDate: '',
170
174
  quoted: id
171
175
  };
172
- return [4 /*yield*/, this.resolveTweets(filter, count, cursor)];
176
+ return [4 /*yield*/, this.resolveTweets(filter, count, cursor)["catch"](function (error) {
177
+ throw _this.getGraphQLError(error);
178
+ })];
173
179
  case 1:
174
180
  // Fetching the quotes using resolveTweets method
175
181
  quotes = _a.sent();
@@ -190,11 +196,12 @@ var TweetResolver = /** @class */ (function (_super) {
190
196
  var _a;
191
197
  return __awaiter(this, void 0, void 0, function () {
192
198
  var likers, next, total, res;
199
+ var _this = this;
193
200
  return __generator(this, function (_b) {
194
201
  switch (_b.label) {
195
202
  case 0:
196
203
  likers = [];
197
- next = new Service_1.Cursor(cursor);
204
+ next = new CursoredData_1.Cursor(cursor);
198
205
  total = 0;
199
206
  // If all likers are to be fetched
200
207
  count = all ? likesCount : count;
@@ -204,7 +211,9 @@ var TweetResolver = /** @class */ (function (_super) {
204
211
  case 1:
205
212
  // If this is the last batch, change batch size to number of remaining likers
206
213
  this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
207
- return [4 /*yield*/, this.context.tweets.getTweetLikers(id, this.batchSize, next.value)];
214
+ return [4 /*yield*/, this.context.tweets.getTweetLikers(id, this.batchSize, next.value)["catch"](function (error) {
215
+ throw _this.getGraphQLError(error);
216
+ })];
208
217
  case 2:
209
218
  res = _b.sent();
210
219
  // If data is available
@@ -248,11 +257,12 @@ var TweetResolver = /** @class */ (function (_super) {
248
257
  var _a;
249
258
  return __awaiter(this, void 0, void 0, function () {
250
259
  var retweeters, next, total, res;
260
+ var _this = this;
251
261
  return __generator(this, function (_b) {
252
262
  switch (_b.label) {
253
263
  case 0:
254
264
  retweeters = [];
255
- next = new Service_1.Cursor(cursor);
265
+ next = new CursoredData_1.Cursor(cursor);
256
266
  total = 0;
257
267
  // If all retweeters are to be fetched
258
268
  count = all ? retweetsCount : count;
@@ -262,7 +272,9 @@ var TweetResolver = /** @class */ (function (_super) {
262
272
  case 1:
263
273
  // If this is the last batch, change batch size to number of remaining retweeters
264
274
  this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
265
- return [4 /*yield*/, this.context.tweets.getTweetRetweeters(id, this.batchSize, next.value)];
275
+ return [4 /*yield*/, this.context.tweets.getTweetRetweeters(id, this.batchSize, next.value)["catch"](function (error) {
276
+ throw _this.getGraphQLError(error);
277
+ })];
266
278
  case 2:
267
279
  res = _b.sent();
268
280
  // If data is available