rettiwt-api 1.0.5 → 1.0.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 (184) hide show
  1. package/README.md +2 -2
  2. package/dist/{queries → graphql/queries}/RootQuery.d.ts +0 -0
  3. package/dist/{queries → graphql/queries}/RootQuery.js +15 -3
  4. package/dist/graphql/queries/RootQuery.js.map +1 -0
  5. package/dist/graphql/resolvers/AccountResolver.d.ts +12 -0
  6. package/dist/graphql/resolvers/AccountResolver.js +84 -0
  7. package/dist/graphql/resolvers/AccountResolver.js.map +1 -0
  8. package/dist/{resolvers → graphql/resolvers}/ResolverBase.d.ts +1 -1
  9. package/dist/{resolvers → graphql/resolvers}/ResolverBase.js +0 -0
  10. package/dist/graphql/resolvers/ResolverBase.js.map +1 -0
  11. package/dist/{resolvers → graphql/resolvers}/TweetResolver.d.ts +10 -9
  12. package/dist/{resolvers → graphql/resolvers}/TweetResolver.js +51 -35
  13. package/dist/graphql/resolvers/TweetResolver.js.map +1 -0
  14. package/dist/{resolvers → graphql/resolvers}/UserResolver.d.ts +5 -4
  15. package/dist/{resolvers → graphql/resolvers}/UserResolver.js +51 -35
  16. package/dist/graphql/resolvers/UserResolver.js.map +1 -0
  17. package/dist/{models/graphql → graphql/types}/Global.d.ts +0 -0
  18. package/dist/{models/graphql → graphql/types}/Global.js +0 -0
  19. package/dist/graphql/types/Global.js.map +1 -0
  20. package/dist/graphql/types/TweetTypes.d.ts +4 -0
  21. package/dist/{models/graphql → graphql/types}/TweetTypes.js +5 -7
  22. package/dist/graphql/types/TweetTypes.js.map +1 -0
  23. package/dist/graphql/types/UserTypes.d.ts +3 -0
  24. package/dist/{models/graphql → graphql/types}/UserTypes.js +9 -11
  25. package/dist/graphql/types/UserTypes.js.map +1 -0
  26. package/dist/index.d.ts +4 -2
  27. package/dist/index.js +5 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/server.js +6 -4
  30. package/dist/server.js.map +1 -1
  31. package/dist/services/AuthService.js +2 -2
  32. package/dist/services/AuthService.js.map +1 -1
  33. package/dist/services/CacheService.d.ts +3 -3
  34. package/dist/services/CacheService.js +22 -75
  35. package/dist/services/CacheService.js.map +1 -1
  36. package/dist/services/FetcherService.d.ts +14 -4
  37. package/dist/services/FetcherService.js +58 -52
  38. package/dist/services/FetcherService.js.map +1 -1
  39. package/dist/services/accounts/AccountService.d.ts +42 -0
  40. package/dist/services/accounts/AccountService.js +291 -0
  41. package/dist/services/accounts/AccountService.js.map +1 -0
  42. package/dist/services/accounts/LoginFlows.d.ts +77 -0
  43. package/dist/services/accounts/LoginFlows.js +92 -0
  44. package/dist/services/accounts/LoginFlows.js.map +1 -0
  45. package/dist/services/data/TweetService.d.ts +6 -6
  46. package/dist/services/data/TweetService.js +44 -27
  47. package/dist/services/data/TweetService.js.map +1 -1
  48. package/dist/services/data/UserAccountService.d.ts +3 -3
  49. package/dist/services/data/UserAccountService.js +22 -8
  50. package/dist/services/data/UserAccountService.js.map +1 -1
  51. package/dist/services/data/UserService.d.ts +42 -0
  52. package/dist/services/data/UserService.js +255 -0
  53. package/dist/services/data/UserService.js.map +1 -0
  54. package/dist/services/helper/Extractors.js +1 -1
  55. package/dist/services/helper/Extractors.js.map +1 -1
  56. package/dist/services/helper/Headers.d.ts +11 -1
  57. package/dist/services/helper/Headers.js +28 -2
  58. package/dist/services/helper/Headers.js.map +1 -1
  59. package/dist/services/helper/Parser.d.ts +1 -1
  60. package/dist/services/helper/Parser.js +4 -3
  61. package/dist/services/helper/Parser.js.map +1 -1
  62. package/dist/services/helper/Urls.d.ts +2 -2
  63. package/dist/services/helper/Urls.js +19 -3
  64. package/dist/services/helper/Urls.js.map +1 -1
  65. package/dist/services/helper/deserializers/Tweets.d.ts +12 -0
  66. package/dist/services/helper/deserializers/Tweets.js +92 -0
  67. package/dist/services/helper/deserializers/Tweets.js.map +1 -0
  68. package/dist/services/helper/deserializers/User.d.ts +0 -0
  69. package/dist/services/helper/deserializers/User.js +2 -0
  70. package/dist/services/helper/deserializers/User.js.map +1 -0
  71. package/dist/services/helper/deserializers/Users.d.ts +7 -0
  72. package/dist/services/helper/deserializers/Users.js +27 -0
  73. package/dist/services/helper/deserializers/Users.js.map +1 -0
  74. package/dist/services/helper/extractors/TweetExtractors.d.ts +0 -0
  75. package/dist/services/helper/extractors/TweetExtractors.js +2 -0
  76. package/dist/services/helper/extractors/TweetExtractors.js.map +1 -0
  77. package/dist/services/helper/extractors/Tweets.d.ts +32 -0
  78. package/dist/services/helper/extractors/Tweets.js +264 -0
  79. package/dist/services/helper/extractors/Tweets.js.map +1 -0
  80. package/dist/services/helper/extractors/UserExtractors.d.ts +45 -0
  81. package/dist/services/helper/extractors/UserExtractors.js +176 -0
  82. package/dist/services/helper/extractors/UserExtractors.js.map +1 -0
  83. package/dist/services/helper/extractors/Users.d.ts +20 -0
  84. package/dist/services/helper/extractors/Users.js +151 -0
  85. package/dist/services/helper/extractors/Users.js.map +1 -0
  86. package/dist/services/helper/urls/Authentication.d.ts +4 -0
  87. package/dist/services/helper/urls/Authentication.js +11 -0
  88. package/dist/services/helper/urls/Authentication.js.map +1 -0
  89. package/dist/services/helper/urls/Tweets.d.ts +32 -0
  90. package/dist/services/helper/urls/Tweets.js +51 -0
  91. package/dist/services/helper/urls/Tweets.js.map +1 -0
  92. package/dist/services/helper/urls/Urls.d.ts +4 -0
  93. package/dist/services/helper/urls/Urls.js +11 -0
  94. package/dist/services/helper/urls/Urls.js.map +1 -0
  95. package/dist/services/helper/urls/Users.d.ts +31 -0
  96. package/dist/services/helper/urls/Users.js +66 -0
  97. package/dist/services/helper/urls/Users.js.map +1 -0
  98. package/dist/types/{graphql/Errors.d.ts → Errors.d.ts} +0 -0
  99. package/dist/types/{graphql/Errors.js → Errors.js} +0 -0
  100. package/dist/types/Errors.js.map +1 -0
  101. package/dist/types/HTTP.d.ts +0 -7
  102. package/dist/types/HTTP.js +1 -10
  103. package/dist/types/HTTP.js.map +1 -1
  104. package/dist/types/Resolvers.d.ts +9 -0
  105. package/dist/types/Resolvers.js +3 -0
  106. package/dist/types/Resolvers.js.map +1 -0
  107. package/dist/types/Service.d.ts +2 -0
  108. package/dist/types/Service.js.map +1 -1
  109. package/dist/types/Tweet.d.ts +1 -0
  110. package/dist/types/Tweet.js.map +1 -1
  111. package/dist/types/User.d.ts +19 -0
  112. package/dist/types/User.js +4 -0
  113. package/dist/types/User.js.map +1 -0
  114. package/dist/types/data/Errors.d.ts +26 -0
  115. package/dist/types/data/Errors.js +36 -0
  116. package/dist/types/data/Errors.js.map +1 -0
  117. package/dist/types/data/Service.d.ts +29 -0
  118. package/dist/types/data/Service.js +19 -0
  119. package/dist/types/data/Service.js.map +1 -0
  120. package/dist/types/data/Tweet.d.ts +41 -0
  121. package/dist/types/data/Tweet.js +5 -0
  122. package/dist/types/data/Tweet.js.map +1 -0
  123. package/dist/types/data/User.d.ts +19 -0
  124. package/dist/types/data/User.js +4 -0
  125. package/dist/types/data/User.js.map +1 -0
  126. package/dist/types/raw/http/Error.d.ts +34 -0
  127. package/dist/types/raw/{user/Users.js → http/Error.js} +1 -1
  128. package/dist/types/raw/http/Error.js.map +1 -0
  129. package/dist/types/raw/http/Response.d.ts +34 -0
  130. package/dist/types/raw/http/Response.js +3 -0
  131. package/dist/types/raw/http/Response.js.map +1 -0
  132. package/package.json +4 -2
  133. package/src/{queries → graphql/queries}/RootQuery.ts +16 -4
  134. package/src/graphql/resolvers/AccountResolver.ts +22 -0
  135. package/src/{resolvers → graphql/resolvers}/ResolverBase.ts +1 -1
  136. package/src/{resolvers → graphql/resolvers}/TweetResolver.ts +43 -30
  137. package/src/{resolvers → graphql/resolvers}/UserResolver.ts +41 -27
  138. package/src/{models/graphql → graphql/types}/Global.ts +0 -0
  139. package/src/{models/graphql → graphql/types}/TweetTypes.ts +9 -11
  140. package/src/{models/graphql → graphql/types}/UserTypes.ts +13 -15
  141. package/src/index.ts +5 -3
  142. package/src/server.ts +6 -4
  143. package/src/services/AuthService.ts +1 -1
  144. package/src/services/CacheService.ts +6 -8
  145. package/src/services/FetcherService.ts +37 -22
  146. package/src/services/accounts/AccountService.ts +156 -0
  147. package/src/services/accounts/LoginFlows.ts +90 -0
  148. package/src/services/data/TweetService.ts +53 -37
  149. package/src/services/data/UserService.ts +187 -0
  150. package/src/services/helper/Headers.ts +27 -1
  151. package/src/services/helper/Parser.ts +6 -4
  152. package/src/services/helper/{Deserializers.ts → deserializers/Tweets.ts} +3 -28
  153. package/src/services/helper/deserializers/Users.ts +26 -0
  154. package/src/services/helper/extractors/Tweets.ts +252 -0
  155. package/src/services/helper/extractors/Users.ts +137 -0
  156. package/src/services/helper/urls/Authentication.ts +6 -0
  157. package/src/services/helper/urls/Tweets.ts +46 -0
  158. package/src/services/helper/urls/Users.ts +62 -0
  159. package/src/types/HTTP.ts +0 -8
  160. package/src/types/Resolvers.ts +9 -0
  161. package/src/types/data/Errors.ts +28 -0
  162. package/src/types/{Service.ts → data/Service.ts} +6 -5
  163. package/src/types/{Tweet.ts → data/Tweet.ts} +1 -0
  164. package/src/types/{UserAccount.ts → data/User.ts} +0 -0
  165. package/tsconfig.json +2 -2
  166. package/dist/models/graphql/Global.js.map +0 -1
  167. package/dist/models/graphql/TweetTypes.d.ts +0 -6
  168. package/dist/models/graphql/TweetTypes.js.map +0 -1
  169. package/dist/models/graphql/UserTypes.d.ts +0 -3
  170. package/dist/models/graphql/UserTypes.js.map +0 -1
  171. package/dist/queries/RootQuery.js.map +0 -1
  172. package/dist/resolvers/ResolverBase.js.map +0 -1
  173. package/dist/resolvers/TweetResolver.js.map +0 -1
  174. package/dist/resolvers/UserResolver.js.map +0 -1
  175. package/dist/test/Test.js +0 -2
  176. package/dist/test/Test.js.map +0 -1
  177. package/dist/types/graphql/Errors.js.map +0 -1
  178. package/dist/types/raw/user/Users.d.ts +0 -120
  179. package/dist/types/raw/user/Users.js.map +0 -1
  180. package/src/services/data/UserAccountService.ts +0 -176
  181. package/src/services/helper/Extractors.ts +0 -455
  182. package/src/services/helper/Urls.ts +0 -109
  183. package/src/types/graphql/Errors.ts +0 -16
  184. package/src/types/raw/user/Tweets.ts +0 -2847
@@ -1,15 +1,6 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.HttpStatus = exports.HttpMethods = void 0;
4
- /**
5
- * @summary Stores all the different type of http requests
6
- */
7
- var HttpMethods;
8
- (function (HttpMethods) {
9
- HttpMethods["POST"] = "POST";
10
- HttpMethods["GET"] = "GET";
11
- })(HttpMethods = exports.HttpMethods || (exports.HttpMethods = {}));
12
- ;
3
+ exports.HttpStatus = void 0;
13
4
  /**
14
5
  * @summary Stores the different types of http status codes
15
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"HTTP.js","sourceRoot":"","sources":["../../src/types/HTTP.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,4BAAa,CAAA;IACb,0BAAW,CAAA;AACf,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAAA,CAAC;AAEF;;GAEG;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"}
1
+ {"version":3,"file":"HTTP.js","sourceRoot":"","sources":["../../src/types/HTTP.ts"],"names":[],"mappings":";;;AAAA;;GAEG;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,9 @@
1
+ /**
2
+ * @summary Stores the data returned from extractors
3
+ */
4
+ export interface DataExtract {
5
+ required: any;
6
+ cursor: string;
7
+ users: any;
8
+ tweets: any;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ //# sourceMappingURL=Resolvers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Resolvers.js","sourceRoot":"","sources":["../../src/types/Resolvers.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import { AccountService } from "../services/accounts/AccountService";
1
2
  import { TweetService } from "../services/data/TweetService";
2
3
  import { UserAccountService } from "../services/data/UserAccountService";
3
4
  /**
@@ -25,4 +26,5 @@ export interface CursoredData<Type> {
25
26
  export interface DataContext {
26
27
  users: UserAccountService;
27
28
  tweets: TweetService;
29
+ account: AccountService;
28
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Service.js","sourceRoot":"","sources":["../../src/types/Service.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH;IAII,cAAc;IACd;;;OAGG;IACH,gBAAY,SAAiB;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;IACL,aAAC;AAAD,CAAC,AAZD,IAYC;AAZY,wBAAM"}
1
+ {"version":3,"file":"Service.js","sourceRoot":"","sources":["../../src/types/Service.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH;IAII,cAAc;IACd;;;OAGG;IACH,gBAAY,SAAiB;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;IACL,aAAC;AAAD,CAAC,AAZD,IAYC;AAZY,wBAAM"}
@@ -9,6 +9,7 @@ export interface TweetFilter {
9
9
  mentions?: string[];
10
10
  startDate?: string;
11
11
  endDate?: string;
12
+ sinceId?: string;
12
13
  quoted?: string;
13
14
  links?: boolean;
14
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../src/types/Tweet.ts"],"names":[],"mappings":";AAAA,kFAAkF;;AAejF,CAAC"}
1
+ {"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../src/types/Tweet.ts"],"names":[],"mappings":";AAAA,kFAAkF;;AAgBjF,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @summary Stores the complete details of the given user's account
3
+ */
4
+ export interface User {
5
+ id: string;
6
+ userName: string;
7
+ fullName: string;
8
+ createdAt: string;
9
+ description: string;
10
+ isVerified: boolean;
11
+ favouritesCount: number;
12
+ followersCount: number;
13
+ followingsCount: number;
14
+ statusesCount: number;
15
+ location: string;
16
+ pinnedTweet: string;
17
+ profileBanner: string;
18
+ profileImage: string;
19
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // This file contains various objects for handling data related to User Account
3
+ exports.__esModule = true;
4
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/types/User.ts"],"names":[],"mappings":";AAAA,+EAA+E"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @summary Stores different types of error messages related to authentication
3
+ */
4
+ export declare enum AuthenticationErrors {
5
+ NotAuthenticated = "Cannot fetch this data without authentication"
6
+ }
7
+ /**
8
+ * @summary Stores different types error messages for validation errors
9
+ */
10
+ export declare enum ValidationErrors {
11
+ InvalidTweetFilter = "Atleast one of fromUsers/toUsers/mentions/hashtags/words argument is required",
12
+ NoUserIdentification = "Either userName or id must be given",
13
+ InvalidCount = "Invalid count provided"
14
+ }
15
+ /**
16
+ * @summary Stores all the different type of error messages that are returned by services
17
+ */
18
+ export declare enum DataErrors {
19
+ UserNotFound = "An account with given username/id was not found",
20
+ TweetNotFound = "A tweet with the given id was not found",
21
+ NoTweetsFound = "No tweets matching the given criteria found",
22
+ NoLikersFound = "No likers found for the tweet with the given id",
23
+ NoRetweetersFound = "No retweeters found for the tweet with the given id",
24
+ NoFollowsFound = "No follow details were found for the user with the given id",
25
+ NoLikedTweetsFound = "No liked tweets were found for the user with the given id"
26
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.DataErrors = exports.ValidationErrors = exports.AuthenticationErrors = void 0;
4
+ /**
5
+ * @summary Stores different types of error messages related to authentication
6
+ */
7
+ var AuthenticationErrors;
8
+ (function (AuthenticationErrors) {
9
+ AuthenticationErrors["NotAuthenticated"] = "Cannot fetch this data without authentication";
10
+ })(AuthenticationErrors = exports.AuthenticationErrors || (exports.AuthenticationErrors = {}));
11
+ ;
12
+ /**
13
+ * @summary Stores different types error messages for validation errors
14
+ */
15
+ var ValidationErrors;
16
+ (function (ValidationErrors) {
17
+ ValidationErrors["InvalidTweetFilter"] = "Atleast one of fromUsers/toUsers/mentions/hashtags/words argument is required";
18
+ ValidationErrors["NoUserIdentification"] = "Either userName or id must be given";
19
+ ValidationErrors["InvalidCount"] = "Invalid count provided";
20
+ })(ValidationErrors = exports.ValidationErrors || (exports.ValidationErrors = {}));
21
+ ;
22
+ /**
23
+ * @summary Stores all the different type of error messages that are returned by services
24
+ */
25
+ var DataErrors;
26
+ (function (DataErrors) {
27
+ DataErrors["UserNotFound"] = "An account with given username/id was not found";
28
+ DataErrors["TweetNotFound"] = "A tweet with the given id was not found";
29
+ DataErrors["NoTweetsFound"] = "No tweets matching the given criteria found";
30
+ DataErrors["NoLikersFound"] = "No likers found for the tweet with the given id";
31
+ DataErrors["NoRetweetersFound"] = "No retweeters found for the tweet with the given id";
32
+ DataErrors["NoFollowsFound"] = "No follow details were found for the user with the given id";
33
+ DataErrors["NoLikedTweetsFound"] = "No liked tweets were found for the user with the given id";
34
+ })(DataErrors = exports.DataErrors || (exports.DataErrors = {}));
35
+ ;
36
+ //# sourceMappingURL=Errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../../src/types/data/Errors.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC5B,0FAAkE,CAAA;AACtE,CAAC,EAFW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAE/B;AAAA,CAAC;AAEF;;GAEG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,wHAAoG,CAAA;IACpG,gFAA4D,CAAA;IAC5D,2DAAuC,CAAA;AAC3C,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAAA,CAAC;AAEF;;GAEG;AACH,IAAY,UAQX;AARD,WAAY,UAAU;IAClB,8EAAgE,CAAA;IAChE,uEAAyD,CAAA;IACzD,2EAA6D,CAAA;IAC7D,+EAAiE,CAAA;IACjE,uFAAyE,CAAA;IACzE,4FAA8E,CAAA;IAC9E,8FAAgF,CAAA;AACpF,CAAC,EARW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAQrB;AAAA,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { AccountService } from "../../services/accounts/AccountService";
2
+ import { TweetService } from "../../services/data/TweetService";
3
+ import { UserService } from "../../services/data/UserService";
4
+ /**
5
+ * @summary Stores the cursor to the batch of data
6
+ */
7
+ export declare class Cursor {
8
+ value: string;
9
+ /**
10
+ * @summary Initializes a new cursor from the given cursor string
11
+ * @param cursorStr The string representation of the cursor
12
+ */
13
+ constructor(cursorStr: string);
14
+ }
15
+ /**
16
+ * @summary Stores cursored data that is returned by services
17
+ */
18
+ export interface CursoredData<Type> {
19
+ list?: Type[];
20
+ next?: Cursor;
21
+ }
22
+ /**
23
+ * @summary Stores the data context from where data is to be fetched
24
+ */
25
+ export interface DataContext {
26
+ users: UserService;
27
+ tweets: TweetService;
28
+ account: AccountService;
29
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Cursor = void 0;
4
+ /**
5
+ * @summary Stores the cursor to the batch of data
6
+ */
7
+ var Cursor = /** @class */ (function () {
8
+ // MEMBER DATA
9
+ /**
10
+ * @summary Initializes a new cursor from the given cursor string
11
+ * @param cursorStr The string representation of the cursor
12
+ */
13
+ function Cursor(cursorStr) {
14
+ this.value = cursorStr;
15
+ }
16
+ return Cursor;
17
+ }());
18
+ exports.Cursor = Cursor;
19
+ //# sourceMappingURL=Service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../src/types/data/Service.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH;IAII,cAAc;IACd;;;OAGG;IACH,gBAAY,SAAiB;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;IACL,aAAC;AAAD,CAAC,AAZD,IAYC;AAZY,wBAAM"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @summary Stores the filter to be used for fetching tweets from TwitterAPI
3
+ */
4
+ export interface TweetFilter {
5
+ words?: string[];
6
+ hashtags?: string[];
7
+ fromUsers?: string[];
8
+ toUsers?: string[];
9
+ mentions?: string[];
10
+ startDate?: string;
11
+ endDate?: string;
12
+ sinceId?: string;
13
+ quoted?: string;
14
+ links?: boolean;
15
+ }
16
+ /**
17
+ * @summary Stores the different types of tweet elements like urls, media, mentions, hashtags, etc
18
+ */
19
+ export interface TweetEntities {
20
+ hashtags: string[];
21
+ urls: string[];
22
+ mentionedUsers: string[];
23
+ media: string[];
24
+ }
25
+ /**
26
+ * @summary Stores a single tweet
27
+ */
28
+ export interface Tweet {
29
+ id: string;
30
+ tweetBy: string;
31
+ createdAt: string;
32
+ entities: TweetEntities;
33
+ quoted: string;
34
+ fullText: string;
35
+ replyTo: string;
36
+ lang: string;
37
+ quoteCount: number;
38
+ replyCount: number;
39
+ retweetCount: number;
40
+ likeCount: number;
41
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // This file contains various objects related to handling of Tweets made by a user
3
+ exports.__esModule = true;
4
+ ;
5
+ //# sourceMappingURL=Tweet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../../src/types/data/Tweet.ts"],"names":[],"mappings":";AAAA,kFAAkF;;AAgBjF,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @summary Stores the complete details of the given user's account
3
+ */
4
+ export interface User {
5
+ id: string;
6
+ userName: string;
7
+ fullName: string;
8
+ createdAt: string;
9
+ description: string;
10
+ isVerified: boolean;
11
+ favouritesCount: number;
12
+ followersCount: number;
13
+ followingsCount: number;
14
+ statusesCount: number;
15
+ location: string;
16
+ pinnedTweet: string;
17
+ profileBanner: string;
18
+ profileImage: string;
19
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // This file contains various objects for handling data related to User Account
3
+ exports.__esModule = true;
4
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/types/data/User.ts"],"names":[],"mappings":";AAAA,+EAA+E"}
@@ -0,0 +1,34 @@
1
+ export interface Root {
2
+ errors: Error[];
3
+ data: Data;
4
+ }
5
+ export interface Error {
6
+ message: string;
7
+ locations: Location[];
8
+ path: string[];
9
+ extensions: Extensions;
10
+ code: number;
11
+ kind: string;
12
+ name: string;
13
+ source: string;
14
+ tracing: Tracing2;
15
+ }
16
+ export interface Location {
17
+ line: number;
18
+ column: number;
19
+ }
20
+ export interface Extensions {
21
+ name: string;
22
+ source: string;
23
+ code: number;
24
+ kind: string;
25
+ tracing: Tracing;
26
+ }
27
+ export interface Tracing {
28
+ trace_id: string;
29
+ }
30
+ export interface Tracing2 {
31
+ trace_id: string;
32
+ }
33
+ export interface Data {
34
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- //# sourceMappingURL=Users.js.map
3
+ //# sourceMappingURL=Error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Error.js","sourceRoot":"","sources":["../../../../src/types/raw/http/Error.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ export default interface Reponse<Type> {
2
+ errors: Error[];
3
+ data: Type;
4
+ }
5
+ export interface Error {
6
+ message: string;
7
+ locations: Location[];
8
+ path: string[];
9
+ extensions: Extensions;
10
+ code: number;
11
+ kind: string;
12
+ name: string;
13
+ source: string;
14
+ tracing: Tracing2;
15
+ }
16
+ export interface Location {
17
+ line: number;
18
+ column: number;
19
+ }
20
+ export interface Extensions {
21
+ name: string;
22
+ source: string;
23
+ code: number;
24
+ kind: string;
25
+ tracing: Tracing;
26
+ }
27
+ export interface Tracing {
28
+ trace_id: string;
29
+ }
30
+ export interface Tracing2 {
31
+ trace_id: string;
32
+ }
33
+ export interface Data {
34
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ //# sourceMappingURL=Response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../../src/types/raw/http/Response.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rettiwt-api",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "An API for fetching data from TwitterAPI, without any rate limits!",
@@ -24,13 +24,15 @@
24
24
  "homepage": "https://github.com/Rishikant181/Rettiwt-API#readme",
25
25
  "dependencies": {
26
26
  "axios": "^1.3.2",
27
- "express": "^4.18.2",
27
+ "cookiejar": "2.1.4",
28
+ "express": "4.18.2",
28
29
  "express-graphql": "0.12.0",
29
30
  "graphql": "14.7.0",
30
31
  "node-cache": "5.1.2",
31
32
  "node-libcurl": "3.0.0"
32
33
  },
33
34
  "devDependencies": {
35
+ "@types/cookiejar": "^2.1.2",
34
36
  "@types/express": "4.17.13",
35
37
  "@types/graphql": "14.5.0",
36
38
  "@types/node": "17.0.24",
@@ -2,13 +2,14 @@
2
2
  import { GraphQLBoolean, GraphQLInt, GraphQLList, GraphQLObjectType, GraphQLString } from 'graphql'
3
3
 
4
4
  // TYPES
5
- import { User } from '../models/graphql/UserTypes';
6
- import { Tweet, TweetList } from '../models/graphql/TweetTypes';
7
- import { TweetFilter } from '../types/Tweet';
5
+ import { User } from '../types/UserTypes';
6
+ import { Tweet, TweetList } from '../types/TweetTypes';
7
+ import { TweetFilter } from '../../types/data/Tweet';
8
8
 
9
9
  // RESOLVERS
10
10
  import UserResolver from '../resolvers/UserResolver';
11
11
  import TweetResolver from '../resolvers/TweetResolver';
12
+ import AccountResolver from '../resolvers/AccountResolver';
12
13
 
13
14
  export const rootQuery = new GraphQLObjectType({
14
15
  name: 'Root',
@@ -45,12 +46,23 @@ export const rootQuery = new GraphQLObjectType({
45
46
  words: { type: new GraphQLList(GraphQLString) },
46
47
  startDate: { type: GraphQLString },
47
48
  endDate: { type: GraphQLString },
49
+ sinceId: { type: GraphQLString },
48
50
  quoted: { type: GraphQLString },
49
51
  links: { type: GraphQLBoolean, defaultValue: false },
50
- count: { type: GraphQLInt, defaultValue: 20 },
52
+ count: { type: GraphQLInt, defaultValue: 10 },
51
53
  cursor: { type: GraphQLString, defaultValue: '' }
52
54
  },
53
55
  resolve: (parent, args, context) => new TweetResolver(context).resolveTweets(args as TweetFilter, args.count, args.cursor)
56
+ },
57
+ Login: {
58
+ type: GraphQLString,
59
+ description: "Returns the cookies that can be used to fetch data from twitter",
60
+ args: {
61
+ email: { type: GraphQLString },
62
+ userName: { type: GraphQLString },
63
+ password: { type: GraphQLString }
64
+ },
65
+ resolve: (parent, args, context) => new AccountResolver(context).resolveLogin(args.email, args.userName, args.password)
54
66
  }
55
67
  }
56
68
  })
@@ -0,0 +1,22 @@
1
+ // RESOLVERS
2
+ import ResolverBase from './ResolverBase';
3
+
4
+ // TYPES
5
+ import { DataContext } from '../../types/data/Service';
6
+
7
+ export default class AccountResolver extends ResolverBase {
8
+ // MEMBER METHODS
9
+ constructor(context: DataContext) {
10
+ super(context);
11
+ }
12
+
13
+ /**
14
+ * @param email The email of the account to be logged into
15
+ * @param userName The username associated with the account
16
+ * @param password The password to the account
17
+ * @returns The cookie string that can be used to authenticate against twitter
18
+ */
19
+ async resolveLogin(email: string, userName: string, password: string): Promise<string> {
20
+ return await this.context.account.login(email, userName, password);
21
+ }
22
+ }
@@ -1,5 +1,5 @@
1
1
  // TYPES
2
- import { DataContext } from '../types/Service';
2
+ import { DataContext } from '../../types/data/Service';
3
3
 
4
4
  export default class ResolverBase {
5
5
  // MEMBER DATA