rettiwt-api 1.1.2 → 1.1.7

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 (301) 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 +21 -0
  18. package/dist/graphql/enums/Errors.js +29 -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 +13 -4
  31. package/dist/graphql/resolvers/UserResolver.js +83 -18
  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/graphql/types/UserTypes.js +1 -1
  39. package/dist/graphql/types/UserTypes.js.map +1 -1
  40. package/dist/index.d.ts +31 -15
  41. package/dist/index.js +32 -17
  42. package/dist/index.js.map +1 -1
  43. package/dist/middlewares/Authentication.d.ts +0 -0
  44. package/dist/middlewares/Authentication.js +2 -0
  45. package/dist/middlewares/Authentication.js.map +1 -0
  46. package/dist/models/args/TweetFilter.d.ts +59 -0
  47. package/dist/models/args/TweetFilter.js +101 -0
  48. package/dist/models/args/TweetFilter.js.map +1 -0
  49. package/dist/models/args/TweetListArgs.d.ts +21 -0
  50. package/dist/models/args/TweetListArgs.js +54 -0
  51. package/dist/models/args/TweetListArgs.js.map +1 -0
  52. package/dist/models/args/UserListArgs.d.ts +21 -0
  53. package/dist/models/args/UserListArgs.js +54 -0
  54. package/dist/models/args/UserListArgs.js.map +1 -0
  55. package/dist/models/auth/AuthCookie.d.ts +21 -0
  56. package/dist/models/auth/AuthCookie.js +33 -0
  57. package/dist/models/auth/AuthCookie.js.map +1 -0
  58. package/dist/models/data/CursoredData.d.ts +34 -0
  59. package/dist/models/data/CursoredData.js +42 -0
  60. package/dist/models/data/CursoredData.js.map +1 -0
  61. package/dist/models/data/DataValidationError.d.ts +18 -0
  62. package/dist/models/data/DataValidationError.js +21 -0
  63. package/dist/models/data/DataValidationError.js.map +1 -0
  64. package/dist/models/data/Errors.d.ts +18 -0
  65. package/dist/models/data/Errors.js +21 -0
  66. package/dist/models/data/Errors.js.map +1 -0
  67. package/dist/models/data/Service.d.ts +33 -0
  68. package/dist/models/data/Service.js +41 -0
  69. package/dist/models/data/Service.js.map +1 -0
  70. package/dist/models/data/Tweet.d.ts +53 -0
  71. package/dist/models/data/Tweet.js +104 -0
  72. package/dist/models/data/Tweet.js.map +1 -0
  73. package/dist/models/data/User.d.ts +41 -0
  74. package/dist/models/data/User.js +32 -0
  75. package/dist/models/data/User.js.map +1 -0
  76. package/dist/models/errors/DataValidationError.d.ts +20 -0
  77. package/dist/models/errors/DataValidationError.js +23 -0
  78. package/dist/models/errors/DataValidationError.js.map +1 -0
  79. package/dist/models/query/Variables.d.ts +2 -0
  80. package/dist/models/query/Variables.js +10 -0
  81. package/dist/models/query/Variables.js.map +1 -0
  82. package/dist/requests/Url.d.ts +5 -0
  83. package/dist/requests/Url.js +12 -0
  84. package/dist/requests/Url.js.map +1 -0
  85. package/dist/requests/payloads/Variables.d.ts +23 -0
  86. package/dist/requests/payloads/Variables.js +24 -0
  87. package/dist/requests/payloads/Variables.js.map +1 -0
  88. package/dist/server.d.ts +1 -1
  89. package/dist/server.js +9 -10
  90. package/dist/server.js.map +1 -1
  91. package/dist/services/accounts/AccountService.d.ts +6 -0
  92. package/dist/services/accounts/AccountService.js +6 -0
  93. package/dist/services/accounts/AccountService.js.map +1 -1
  94. package/dist/services/auth/AccountService.d.ts +88 -0
  95. package/dist/services/auth/AccountService.js +392 -0
  96. package/dist/services/auth/AccountService.js.map +1 -0
  97. package/dist/services/auth/AuthService.d.ts +31 -0
  98. package/dist/services/auth/AuthService.js +118 -0
  99. package/dist/services/auth/AuthService.js.map +1 -0
  100. package/dist/services/auth/LoginFlows.d.ts +77 -0
  101. package/dist/services/auth/LoginFlows.js +92 -0
  102. package/dist/services/auth/LoginFlows.js.map +1 -0
  103. package/dist/services/data/TweetService.d.ts +46 -16
  104. package/dist/services/data/TweetService.js +71 -54
  105. package/dist/services/data/TweetService.js.map +1 -1
  106. package/dist/services/data/UserService.d.ts +58 -19
  107. package/dist/services/data/UserService.js +104 -68
  108. package/dist/services/data/UserService.js.map +1 -1
  109. package/dist/services/helper/Headers.d.ts +4 -4
  110. package/dist/services/helper/Headers.js.map +1 -1
  111. package/dist/services/helper/Parser.d.ts +2 -2
  112. package/dist/services/helper/Parser.js.map +1 -1
  113. package/dist/services/helper/extractors/Tweets.d.ts +6 -6
  114. package/dist/services/helper/extractors/Tweets.js +1 -1
  115. package/dist/services/helper/extractors/Tweets.js.map +1 -1
  116. package/dist/services/helper/extractors/Users.d.ts +10 -4
  117. package/dist/services/helper/extractors/Users.js +54 -2
  118. package/dist/services/helper/extractors/Users.js.map +1 -1
  119. package/dist/services/helper/payloads/LoginFlows.d.ts +77 -0
  120. package/dist/services/helper/payloads/LoginFlows.js +92 -0
  121. package/dist/services/helper/payloads/LoginFlows.js.map +1 -0
  122. package/dist/services/helper/urls/Users.d.ts +8 -1
  123. package/dist/services/helper/urls/Users.js +12 -2
  124. package/dist/services/helper/urls/Users.js.map +1 -1
  125. package/dist/services/util/CacheService.d.ts +33 -0
  126. package/dist/services/util/CacheService.js +96 -0
  127. package/dist/services/util/CacheService.js.map +1 -0
  128. package/dist/services/util/FetcherService.d.ts +65 -0
  129. package/dist/services/util/FetcherService.js +214 -0
  130. package/dist/services/util/FetcherService.js.map +1 -0
  131. package/dist/types/Args.d.ts +38 -0
  132. package/dist/types/Args.js +5 -0
  133. package/dist/types/Args.js.map +1 -0
  134. package/dist/types/Authentication.d.ts +17 -2
  135. package/dist/types/Authentication.js +1 -0
  136. package/dist/types/Authentication.js.map +1 -1
  137. package/dist/types/Query.d.ts +80 -0
  138. package/dist/types/Query.js +3 -0
  139. package/dist/types/Query.js.map +1 -0
  140. package/dist/types/Resolvers.d.ts +5 -4
  141. package/dist/types/Rettiwt.d.ts +16 -0
  142. package/dist/types/Rettiwt.js +3 -0
  143. package/dist/types/Rettiwt.js.map +1 -0
  144. package/dist/types/Service.d.ts +15 -23
  145. package/dist/types/Service.js +2 -16
  146. package/dist/types/Service.js.map +1 -1
  147. package/dist/types/Tweet.d.ts +25 -19
  148. package/dist/types/Tweet.js +0 -2
  149. package/dist/types/Tweet.js.map +1 -1
  150. package/dist/types/User.d.ts +35 -0
  151. package/dist/types/User.js +3 -0
  152. package/dist/types/User.js.map +1 -0
  153. package/dist/types/args/TweetFilter.d.ts +54 -0
  154. package/dist/types/args/TweetFilter.js +96 -0
  155. package/dist/types/args/TweetFilter.js.map +1 -0
  156. package/dist/types/args/TweetListArg.d.ts +10 -0
  157. package/dist/types/args/TweetListArg.js +42 -0
  158. package/dist/types/args/TweetListArg.js.map +1 -0
  159. package/dist/types/args/TweetListArgs.d.ts +20 -0
  160. package/dist/types/args/TweetListArgs.js +52 -0
  161. package/dist/types/args/TweetListArgs.js.map +1 -0
  162. package/dist/types/args/UserListArgs.d.ts +16 -0
  163. package/dist/types/args/UserListArgs.js +48 -0
  164. package/dist/types/args/UserListArgs.js.map +1 -0
  165. package/dist/types/data/TweetFilter.d.ts +49 -0
  166. package/dist/types/data/TweetFilter.js +63 -0
  167. package/dist/types/data/TweetFilter.js.map +1 -0
  168. package/dist/types/interfaces/Args.d.ts +38 -0
  169. package/dist/types/interfaces/Args.js +5 -0
  170. package/dist/types/interfaces/Args.js.map +1 -0
  171. package/dist/types/interfaces/Authentication.d.ts +40 -0
  172. package/dist/types/interfaces/Authentication.js +5 -0
  173. package/dist/types/interfaces/Authentication.js.map +1 -0
  174. package/dist/types/interfaces/Resolvers.d.ts +14 -0
  175. package/dist/types/interfaces/Resolvers.js +3 -0
  176. package/dist/types/interfaces/Resolvers.js.map +1 -0
  177. package/dist/types/interfaces/Rettiwt.d.ts +16 -0
  178. package/dist/types/interfaces/Rettiwt.js +3 -0
  179. package/dist/types/interfaces/Rettiwt.js.map +1 -0
  180. package/dist/types/interfaces/Service.d.ts +13 -0
  181. package/dist/types/interfaces/Service.js +3 -0
  182. package/dist/types/interfaces/Service.js.map +1 -0
  183. package/dist/types/interfaces/Services.d.ts +13 -0
  184. package/dist/types/interfaces/Services.js +3 -0
  185. package/dist/types/interfaces/Services.js.map +1 -0
  186. package/dist/types/interfaces/Tweet.d.ts +46 -0
  187. package/dist/types/interfaces/Tweet.js +3 -0
  188. package/dist/types/interfaces/Tweet.js.map +1 -0
  189. package/dist/types/interfaces/TweetFilter.d.ts +0 -0
  190. package/dist/types/interfaces/TweetFilter.js +2 -0
  191. package/dist/types/interfaces/TweetFilter.js.map +1 -0
  192. package/{src/types/data/User.ts → dist/types/interfaces/User.d.ts} +35 -51
  193. package/dist/types/interfaces/User.js +3 -0
  194. package/dist/types/interfaces/User.js.map +1 -0
  195. package/dist/types/raw/data/tweet/Favouriters.d.ts +164 -0
  196. package/dist/types/raw/data/tweet/Favouriters.js +3 -0
  197. package/dist/types/raw/data/tweet/Favouriters.js.map +1 -0
  198. package/dist/types/raw/data/tweet/Retweeters.d.ts +171 -0
  199. package/dist/types/raw/data/tweet/Retweeters.js +3 -0
  200. package/dist/types/raw/data/tweet/Retweeters.js.map +1 -0
  201. package/dist/types/raw/data/tweet/Tweet.d.ts +746 -0
  202. package/dist/types/raw/data/tweet/Tweet.js +3 -0
  203. package/dist/types/raw/data/tweet/Tweet.js.map +1 -0
  204. package/dist/types/raw/data/tweet/Tweets.d.ts +386 -0
  205. package/dist/types/raw/data/tweet/Tweets.js +3 -0
  206. package/dist/types/raw/data/tweet/Tweets.js.map +1 -0
  207. package/dist/types/raw/data/user/Followers.d.ts +176 -0
  208. package/dist/types/raw/data/user/Followers.js +3 -0
  209. package/dist/types/raw/data/user/Followers.js.map +1 -0
  210. package/dist/types/raw/data/user/Following.d.ts +176 -0
  211. package/dist/types/raw/data/user/Following.js +3 -0
  212. package/dist/types/raw/data/user/Following.js.map +1 -0
  213. package/dist/types/raw/data/user/Likes.d.ts +1059 -0
  214. package/dist/types/raw/data/user/Likes.js +3 -0
  215. package/dist/types/raw/data/user/Likes.js.map +1 -0
  216. package/dist/types/raw/data/user/User.d.ts +117 -0
  217. package/dist/types/raw/data/user/User.js +3 -0
  218. package/dist/types/raw/data/user/User.js.map +1 -0
  219. package/dist/types/raw/query/tweet/Details.d.ts +80 -0
  220. package/dist/types/raw/query/tweet/Details.js +5 -0
  221. package/dist/types/raw/query/tweet/Details.js.map +1 -0
  222. package/dist/types/raw/query/tweet/Engagements.d.ts +29 -0
  223. package/dist/types/raw/query/tweet/Engagements.js +3 -0
  224. package/dist/types/raw/query/tweet/Engagements.js.map +1 -0
  225. package/dist/types/raw/query/tweet/Likes.d.ts +29 -0
  226. package/dist/types/raw/query/tweet/Likes.js +3 -0
  227. package/dist/types/raw/query/tweet/Likes.js.map +1 -0
  228. package/dist/types/raw/query/tweet/Retweets.d.ts +29 -0
  229. package/dist/types/raw/query/tweet/Retweets.js +3 -0
  230. package/dist/types/raw/query/tweet/Retweets.js.map +1 -0
  231. package/dist/types/raw/query/tweet/Search.d.ts +40 -0
  232. package/dist/types/raw/query/tweet/Search.js +3 -0
  233. package/dist/types/raw/query/tweet/Search.js.map +1 -0
  234. package/dist/types/raw/query/tweet/TweetDetails.d.ts +34 -0
  235. package/dist/types/raw/query/tweet/TweetDetails.js +5 -0
  236. package/dist/types/raw/query/tweet/TweetDetails.js.map +1 -0
  237. package/dist/types/raw/query/tweet/TweetLike.d.ts +29 -0
  238. package/dist/types/raw/query/tweet/TweetLike.js +3 -0
  239. package/dist/types/raw/query/tweet/TweetLike.js.map +1 -0
  240. package/dist/types/raw/query/tweet/TweetLikes.d.ts +29 -0
  241. package/dist/types/raw/query/tweet/TweetLikes.js +3 -0
  242. package/dist/types/raw/query/tweet/TweetLikes.js.map +1 -0
  243. package/dist/types/raw/query/tweet/TweetRetweets.d.ts +0 -0
  244. package/dist/types/raw/query/tweet/TweetRetweets.js +2 -0
  245. package/dist/types/raw/query/tweet/TweetRetweets.js.map +1 -0
  246. package/dist/types/raw/query/user/Details.d.ts +34 -0
  247. package/dist/types/raw/query/user/Details.js +3 -0
  248. package/dist/types/raw/query/user/Details.js.map +1 -0
  249. package/dist/types/raw/user/Tweets.d.ts +668 -1584
  250. package/dist/types/services/args/TweetFilter.d.ts +50 -0
  251. package/dist/types/services/args/TweetFilter.js +76 -0
  252. package/dist/types/services/args/TweetFilter.js.map +1 -0
  253. package/package.json +6 -3
  254. package/src/enums/Errors.ts +21 -0
  255. package/src/graphql/enums/Errors.ts +22 -0
  256. package/src/graphql/queries/RootQuery.ts +11 -4
  257. package/src/graphql/resolvers/AccountResolver.ts +3 -3
  258. package/src/graphql/resolvers/ResolverBase.ts +19 -5
  259. package/src/graphql/resolvers/TweetResolver.ts +26 -17
  260. package/src/graphql/resolvers/UserResolver.ts +75 -20
  261. package/src/graphql/types/TweetTypes.ts +2 -2
  262. package/src/graphql/types/UserTypes.ts +4 -4
  263. package/src/index.ts +39 -17
  264. package/src/models/args/TweetFilter.ts +119 -0
  265. package/src/models/args/TweetListArgs.ts +47 -0
  266. package/src/models/args/UserListArgs.ts +47 -0
  267. package/src/models/auth/AuthCookie.ts +43 -0
  268. package/src/models/data/CursoredData.ts +45 -0
  269. package/src/models/data/Tweet.ts +118 -0
  270. package/src/models/data/User.ts +72 -0
  271. package/src/models/errors/DataValidationError.ts +29 -0
  272. package/src/server.ts +9 -10
  273. package/src/services/{accounts → auth}/AccountService.ts +71 -19
  274. package/src/services/auth/AuthService.ts +81 -0
  275. package/src/services/data/TweetService.ts +81 -62
  276. package/src/services/data/UserService.ts +118 -80
  277. package/src/services/helper/Headers.ts +4 -4
  278. package/src/services/helper/Parser.ts +2 -2
  279. package/src/services/helper/extractors/Tweets.ts +7 -7
  280. package/src/services/helper/extractors/Users.ts +60 -5
  281. package/src/services/helper/urls/Users.ts +39 -23
  282. package/src/services/{CacheService.ts → util/CacheService.ts} +4 -1
  283. package/src/services/{FetcherService.ts → util/FetcherService.ts} +19 -11
  284. package/src/types/Args.ts +49 -0
  285. package/src/types/Authentication.ts +29 -7
  286. package/src/types/Resolvers.ts +5 -4
  287. package/src/types/Rettiwt.ts +20 -0
  288. package/src/types/Service.ts +24 -0
  289. package/src/types/Tweet.ts +61 -0
  290. package/src/types/User.ts +48 -0
  291. package/src/types/raw/user/Tweets.ts +1747 -0
  292. package/tsconfig.json +2 -2
  293. package/src/services/AuthService.ts +0 -68
  294. package/src/services/helper/deserializers/Tweets.ts +0 -70
  295. package/src/services/helper/deserializers/Users.ts +0 -26
  296. package/src/types/data/Errors.ts +0 -37
  297. package/src/types/data/Service.ts +0 -55
  298. package/src/types/data/Tweet.ts +0 -123
  299. package/src/types/raw/auth/Cookie.ts +0 -16
  300. /package/src/{types → enums}/HTTP.ts +0 -0
  301. /package/src/services/{accounts → helper/payloads}/LoginFlows.ts +0 -0
@@ -2,18 +2,22 @@
2
2
  import { curly, CurlyResult } from 'node-libcurl';
3
3
 
4
4
  // SERVICES
5
- import { AuthService } from './AuthService';
5
+ import { AuthService } from '../auth/AuthService';
6
6
  import { CacheService } from './CacheService';
7
7
 
8
+ // MODELS
9
+ import { Tweet } from '../../models/data/Tweet';
10
+ import { User } from '../../models/data/User';
11
+
8
12
  // TYPES
9
- import { HttpStatus } from "../types/HTTP";
10
- import { Result as RawUser } from '../types/raw/user/User';
11
- import { Result as RawTweet } from '../types/raw/tweet/Tweet';
13
+ import { Result as RawUser } from '../../types/raw/user/User';
14
+ import { Result as RawTweet } from '../../types/raw/tweet/Tweet';
15
+
16
+ // ENUMS
17
+ import { HttpStatus } from "../../enums/HTTP";
12
18
 
13
19
  // HELPERS
14
- import * as Headers from './helper/Headers'
15
- import * as UserDeserializers from './helper/deserializers/Users';
16
- import * as TweetDeserializers from './helper/deserializers/Tweets';
20
+ import * as Headers from '../helper/Headers'
17
21
  import { CurlyOptions } from 'node-libcurl/dist/curly';
18
22
 
19
23
  /**
@@ -55,8 +59,10 @@ export class FetcherService {
55
59
  * The middleware for handling any HTTP error.
56
60
  *
57
61
  * @param res The response object received.
58
- * @throws {@link HttpStatus}.
62
+ *
59
63
  * @returns The received response, if no HTTP errors are found.
64
+ *
65
+ * @throws {@link HttpStatus} error, if any HTTP error is found.
60
66
  */
61
67
  private handleHTTPError(res: CurlyResult): CurlyResult {
62
68
  /**
@@ -79,6 +85,7 @@ export class FetcherService {
79
85
  * @param authenticate Whether to authenticate requests or not.
80
86
  * @param method The HTTP method (from {@link HttpMethods}) to use.
81
87
  * @param data The data to be sent along with the request (for POST request).
88
+ *
82
89
  * @returns The {@link CurlyResult} received.
83
90
  */
84
91
  protected async request<DataType>(url: string, authenticate: boolean = true, method: HttpMethods = HttpMethods.GET, data?: any): Promise<CurlyResult<DataType>> {
@@ -114,15 +121,15 @@ export class FetcherService {
114
121
  /**
115
122
  * Caches the extracted data into the {@link CacheService} instance.
116
123
  *
117
- * @param data The extracted data to be cached
124
+ * @param data The extracted data to be cached.
118
125
  */
119
126
  protected cacheData(data: any): void {
120
127
  /**
121
128
  * The extracted data is in raw form.
122
129
  * This raw data is deserialized into the respective known types.
123
130
  */
124
- let users = data.users.map((user: RawUser) => UserDeserializers.toUser(user));
125
- let tweets = data.tweets.map((tweet: RawTweet) => TweetDeserializers.toTweet(tweet));
131
+ let users = data.users.map((user: RawUser) => new User(user));
132
+ let tweets = data.tweets.map((tweet: RawTweet) => new Tweet(tweet));
126
133
 
127
134
  // Caching the data
128
135
  this.cache.write(users);
@@ -133,6 +140,7 @@ export class FetcherService {
133
140
  * Fetches the data with the given id from the cache.
134
141
  *
135
142
  * @param id The id of the data to be read from cache.
143
+ *
136
144
  * @returns The data with the given id. If does not exists, returns undefined.
137
145
  */
138
146
  protected readData(id: string): any {
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The filter to be used for fetching tweets from Twitter.
3
+ *
4
+ * @public
5
+ */
6
+ export interface ITweetFilter {
7
+ /** The list of words to search. */
8
+ words?: string[];
9
+
10
+ /** The list of hashtags to search. */
11
+ hashtags?: string[];
12
+
13
+ /** The list of usernames whose tweets are to be searched. */
14
+ fromUsers?: string[];
15
+
16
+ /** The list of username to whom the tweets to be searched, are adressed. */
17
+ toUsers?: string[];
18
+
19
+ /** The list of username mentioned in the tweets to search. */
20
+ mentions?: string[];
21
+
22
+ /** The date starting from which tweets are to be searched. */
23
+ startDate?: string;
24
+
25
+ /** The date upto which tweets are to be searched. */
26
+ endDate?: string;
27
+
28
+ /** The id of the tweet, after which the tweets are to be searched. */
29
+ sinceId?: string;
30
+
31
+ /** The id of the tweet which is quoted in the tweets to search. */
32
+ quoted?: string;
33
+
34
+ /** Whether to fetch tweets that are links or not. */
35
+ links?: boolean;
36
+ };
37
+
38
+ /**
39
+ * The arguments for fetching cursored list.
40
+ *
41
+ * @public
42
+ */
43
+ export interface IListArgs {
44
+ /** The number of data items to fetch. */
45
+ count?: number;
46
+
47
+ /** The cursor to the batch of data to fetch. */
48
+ cursor?: string;
49
+ };
@@ -3,17 +3,18 @@
3
3
  *
4
4
  * @internal
5
5
  */
6
- export interface GuestCredentials {
6
+ export interface IGuestCredentials {
7
7
  /** The bearer token from twitter.com.
8
8
  *
9
9
  * @remarks This is a static bearer token from twitter.com.
10
10
  */
11
- authToken: string,
11
+ authToken: string;
12
+
12
13
  /** The guest token.
13
14
  *
14
15
  * @remarks This is generated from twitter.com by calling GETTING https://api.twitter.com/1.1/guest/activate.json endpoint.
15
16
  */
16
- guestToken: string
17
+ guestToken: string;
17
18
  };
18
19
 
19
20
  /**
@@ -21,21 +22,42 @@ export interface GuestCredentials {
21
22
  *
22
23
  * @internal
23
24
  */
24
- export interface AuthCredentials {
25
+ export interface IAuthCredentials {
25
26
  /** The bearer token from twitter.com.
26
27
  *
27
28
  * @remarks This is a static bearer token from twitter.com.
28
29
  */
29
- authToken: string,
30
+ authToken: string;
31
+
30
32
  /** The guest token.
31
33
  *
32
34
  * @remarks This is generated from twitter.com by calling GETTING https://api.twitter.com/1.1/guest/activate.json endpoint.
33
35
  */
34
- csrfToken: string,
36
+ csrfToken: string;
37
+
35
38
  /** The cookie of the twitter account, which is used to authenticate against twitter.
36
39
  *
37
40
  * @remarks The cookie can be obtained/scraped from any one of the outgoing HTTP request headers to twitter.com.
38
41
  * It can also be obtained after logging in to twitter, from the 'set-cookie' field of response.
39
42
  */
40
- cookie: string
43
+ cookie: string;
44
+ };
45
+
46
+ /**
47
+ * The cookie containing the tokens that are used to authenticate against Twitter.
48
+ *
49
+ * @public
50
+ */
51
+ export interface IAuthCookie {
52
+ /** Token used to authenticate a device. */
53
+ kdt: string;
54
+
55
+ /** Token used to authenticate a user using a Twitter ID. */
56
+ twid: string;
57
+
58
+ /** The CSRF token of the session. */
59
+ ct0: string;
60
+
61
+ /** The authentication token used while logging in to the account. */
62
+ auth_token: string;
41
63
  };
@@ -1,17 +1,18 @@
1
1
  /**
2
2
  * The data returned from extractor methods.
3
+ *
3
4
  * @internal
4
5
  */
5
- export interface DataExtract {
6
+ export interface IDataExtract {
6
7
  /** The required data. */
7
- required: any;
8
+ required: any[];
8
9
 
9
10
  /** The cursor string to the next batch of data. */
10
11
  cursor: string;
11
12
 
12
13
  /** Additional extracted user details. */
13
- users: any;
14
+ users: any[];
14
15
 
15
16
  /** Additional extracted tweet details */
16
- tweets: any;
17
+ tweets: any[];
17
18
  }
@@ -0,0 +1,20 @@
1
+ // SERVICES
2
+ import { AccountService } from "../services/auth/AccountService";
3
+ import { TweetService } from "../services/data/TweetService";
4
+ import { UserService } from "../services/data/UserService";
5
+
6
+ /**
7
+ * The data context from where data is to be fetched.
8
+ *
9
+ * @public
10
+ */
11
+ export interface IDataContext {
12
+ /** Handles data related to users. */
13
+ users: UserService,
14
+
15
+ /** Handles data related to tweets. */
16
+ tweets: TweetService,
17
+
18
+ /** Handles account related operations. */
19
+ account: AccountService
20
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The cursor to the batch of data to be fetched.
3
+ *
4
+ * @public
5
+ */
6
+ export interface ICursor {
7
+ /** The cursor string. */
8
+ value: string;
9
+ };
10
+
11
+ /**
12
+ * The data that us fetched batch-wise along with a cursor.
13
+ *
14
+ * @typeParam Type - The type of data present in the list.
15
+ *
16
+ * @public
17
+ */
18
+ export interface ICursoredData<Type> {
19
+ /** The list of data of the given type. */
20
+ list: Type[];
21
+
22
+ /** The cursor to the next batch of data. */
23
+ next: ICursor;
24
+ };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The different types parsed entities like urls, media, mentions, hashtags, etc.
3
+ *
4
+ * @public
5
+ */
6
+ export interface ITweetEntities {
7
+ /** The list of hashtags mentioned in the tweet. */
8
+ hashtags: string[];
9
+
10
+ /** The list of urls mentioned in the tweet. */
11
+ urls: string[];
12
+
13
+ /** The list of IDs of users mentioned in the tweet. */
14
+ mentionedUsers: string[];
15
+
16
+ /** The list of urls to various media mentioned in the tweet. */
17
+ media: string[];
18
+ }
19
+
20
+ /**
21
+ * The details of a single Tweet.
22
+ *
23
+ * @public
24
+ */
25
+ export interface ITweet {
26
+ /** The rest id of the tweet. */
27
+ id: string;
28
+
29
+ /** The rest id of the user who made the tweet. */
30
+ tweetBy: string;
31
+
32
+ /** The date and time of creation of the tweet, in UTC string format. */
33
+ createdAt: string;
34
+
35
+ /** Additional tweet entities like urls, mentions, etc. */
36
+ entities: ITweetEntities;
37
+
38
+ /** The rest id of the tweet which is quoted in the tweet. */
39
+ quoted: string;
40
+
41
+ /** The full text content of the tweet. */
42
+ fullText: string;
43
+
44
+ /** The rest id of the user to which the tweet is a reply. */
45
+ replyTo: string;
46
+
47
+ /** The language in which the tweet is written. */
48
+ lang: string;
49
+
50
+ /** The number of quotes of the tweet. */
51
+ quoteCount: number;
52
+
53
+ /** The number of replies to the tweet. */
54
+ replyCount: number;
55
+
56
+ /** The number of retweets of the tweet. */
57
+ retweetCount: number;
58
+
59
+ /** The number of likes of the tweet. */
60
+ likeCount: number;
61
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The details of a single user.
3
+ *
4
+ * @public
5
+ */
6
+ export interface IUser {
7
+ /** The rest id of the user. */
8
+ id: string;
9
+
10
+ /** The username/screenname of the user. */
11
+ userName: string;
12
+
13
+ /** The full name of the user. */
14
+ fullName: string;
15
+
16
+ /** The creation date of user's account. */
17
+ createdAt: string;
18
+
19
+ /** The user's description. */
20
+ description: string;
21
+
22
+ /** Whether the account is verified or not. */
23
+ isVerified: boolean;
24
+
25
+ /** The number of tweets liked by the user. */
26
+ favouritesCount: number;
27
+
28
+ /** The number of followers of the user. */
29
+ followersCount: number;
30
+
31
+ /** The number of following of the user. */
32
+ followingsCount: number;
33
+
34
+ /** The number of tweets made by the user. */
35
+ statusesCount: number;
36
+
37
+ /** The location of user as provided by user. */
38
+ location: string;
39
+
40
+ /** The rest id of the tweet pinned in the user's profile. */
41
+ pinnedTweet: string;
42
+
43
+ /** The url of the profile banner image. */
44
+ profileBanner: string;
45
+
46
+ /** The url of the profile image. */
47
+ profileImage: string;
48
+ }