rettiwt-api 1.1.0 → 1.1.1

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 (125) hide show
  1. package/.github/workflows/build-docs.yml +27 -0
  2. package/README.md +3 -1
  3. package/dist/Test.d.ts +0 -0
  4. package/dist/Test.js +2 -0
  5. package/dist/Test.js.map +1 -0
  6. package/dist/index.d.ts +16 -5
  7. package/dist/index.js +22 -8
  8. package/dist/index.js.map +1 -1
  9. package/dist/models/graphql/Global.d.ts +4 -0
  10. package/dist/models/graphql/Global.js +13 -0
  11. package/dist/models/graphql/Global.js.map +1 -0
  12. package/dist/models/graphql/TweetTypes.d.ts +6 -0
  13. package/dist/models/graphql/TweetTypes.js +156 -0
  14. package/dist/models/graphql/TweetTypes.js.map +1 -0
  15. package/dist/models/graphql/UserTypes.d.ts +3 -0
  16. package/dist/models/graphql/UserTypes.js +139 -0
  17. package/dist/models/graphql/UserTypes.js.map +1 -0
  18. package/dist/queries/RootQuery.d.ts +4 -0
  19. package/dist/queries/RootQuery.js +70 -0
  20. package/dist/queries/RootQuery.js.map +1 -0
  21. package/dist/resolvers/AccountResolver.d.ts +12 -0
  22. package/dist/resolvers/AccountResolver.js +84 -0
  23. package/dist/resolvers/AccountResolver.js.map +1 -0
  24. package/dist/resolvers/ResolverBase.d.ts +5 -0
  25. package/dist/resolvers/ResolverBase.js +11 -0
  26. package/dist/resolvers/ResolverBase.js.map +1 -0
  27. package/dist/resolvers/TweetResolver.d.ts +54 -0
  28. package/dist/resolvers/TweetResolver.js +332 -0
  29. package/dist/resolvers/TweetResolver.js.map +1 -0
  30. package/dist/resolvers/UserResolver.d.ts +38 -0
  31. package/dist/resolvers/UserResolver.js +253 -0
  32. package/dist/resolvers/UserResolver.js.map +1 -0
  33. package/dist/services/AuthService.d.ts +6 -2
  34. package/dist/services/AuthService.js +4 -3
  35. package/dist/services/AuthService.js.map +1 -1
  36. package/dist/services/CacheService.d.ts +12 -7
  37. package/dist/services/CacheService.js +12 -7
  38. package/dist/services/CacheService.js.map +1 -1
  39. package/dist/services/FetcherService.d.ts +32 -12
  40. package/dist/services/FetcherService.js +45 -14
  41. package/dist/services/FetcherService.js.map +1 -1
  42. package/dist/services/accounts/AccountService.d.ts +23 -6
  43. package/dist/services/accounts/AccountService.js +34 -9
  44. package/dist/services/accounts/AccountService.js.map +1 -1
  45. package/dist/services/data/TrendService.d.ts +17 -0
  46. package/dist/services/data/TrendService.js +116 -0
  47. package/dist/services/data/TrendService.js.map +1 -0
  48. package/dist/services/data/TweetService.d.ts +22 -15
  49. package/dist/services/data/TweetService.js +22 -15
  50. package/dist/services/data/TweetService.js.map +1 -1
  51. package/dist/services/data/UserAccountService.d.ts +42 -0
  52. package/dist/services/data/UserAccountService.js +239 -0
  53. package/dist/services/data/UserAccountService.js.map +1 -0
  54. package/dist/services/data/UserService.d.ts +21 -15
  55. package/dist/services/data/UserService.js +21 -15
  56. package/dist/services/data/UserService.js.map +1 -1
  57. package/dist/services/helper/Deserializers.d.ts +19 -0
  58. package/dist/services/helper/Deserializers.js +115 -0
  59. package/dist/services/helper/Deserializers.js.map +1 -0
  60. package/dist/services/helper/Extractors.d.ts +104 -0
  61. package/dist/services/helper/Extractors.js +432 -0
  62. package/dist/services/helper/Extractors.js.map +1 -0
  63. package/dist/services/helper/Urls.d.ts +85 -0
  64. package/dist/services/helper/Urls.js +130 -0
  65. package/dist/services/helper/Urls.js.map +1 -0
  66. package/dist/services/helper/extractors/Trends.d.ts +3 -0
  67. package/dist/services/helper/extractors/Trends.js +51 -0
  68. package/dist/services/helper/extractors/Trends.js.map +1 -0
  69. package/dist/services/helper/urls/Trends.d.ts +7 -0
  70. package/dist/services/helper/urls/Trends.js +13 -0
  71. package/dist/services/helper/urls/Trends.js.map +1 -0
  72. package/dist/types/Authentication.d.ts +27 -2
  73. package/dist/types/Authentication.js.map +1 -1
  74. package/dist/types/HTTP.d.ts +3 -1
  75. package/dist/types/HTTP.js +3 -1
  76. package/dist/types/HTTP.js.map +1 -1
  77. package/dist/types/Resolvers.d.ts +6 -1
  78. package/dist/types/Service.d.ts +30 -0
  79. package/dist/types/Service.js +19 -0
  80. package/dist/types/Service.js.map +1 -0
  81. package/dist/types/Trends.d.ts +50 -0
  82. package/dist/types/Trends.js +3 -0
  83. package/dist/types/Trends.js.map +1 -0
  84. package/dist/types/Tweet.d.ts +40 -0
  85. package/dist/types/Tweet.js +5 -0
  86. package/dist/types/Tweet.js.map +1 -0
  87. package/dist/types/UserAccount.d.ts +19 -0
  88. package/dist/types/UserAccount.js +4 -0
  89. package/dist/types/UserAccount.js.map +1 -0
  90. package/dist/types/data/Errors.d.ts +9 -3
  91. package/dist/types/data/Errors.js +9 -3
  92. package/dist/types/data/Errors.js.map +1 -1
  93. package/dist/types/data/Service.d.ts +19 -5
  94. package/dist/types/data/Service.js +6 -3
  95. package/dist/types/data/Service.js.map +1 -1
  96. package/dist/types/data/Tweet.d.ts +60 -3
  97. package/dist/types/data/Tweet.js +0 -1
  98. package/dist/types/data/Tweet.js.map +1 -1
  99. package/dist/types/data/User.d.ts +20 -1
  100. package/dist/types/data/User.js +0 -1
  101. package/dist/types/data/User.js.map +1 -1
  102. package/dist/types/graphql/Errors.d.ts +15 -0
  103. package/dist/types/graphql/Errors.js +23 -0
  104. package/dist/types/graphql/Errors.js.map +1 -0
  105. package/dist/types/raw/general/Trends.d.ts +324 -0
  106. package/dist/types/raw/general/Trends.js +3 -0
  107. package/dist/types/raw/general/Trends.js.map +1 -0
  108. package/dist/types/raw/user/Tweets.d.ts +2428 -0
  109. package/dist/types/raw/user/Tweets.js +3 -0
  110. package/dist/types/raw/user/Tweets.js.map +1 -0
  111. package/package.json +5 -4
  112. package/src/index.ts +19 -6
  113. package/src/services/AuthService.ts +13 -7
  114. package/src/services/CacheService.ts +12 -7
  115. package/src/services/FetcherService.ts +62 -21
  116. package/src/services/accounts/AccountService.ts +38 -12
  117. package/src/services/data/TweetService.ts +25 -18
  118. package/src/services/data/UserService.ts +21 -15
  119. package/src/types/Authentication.ts +27 -2
  120. package/src/types/HTTP.ts +4 -2
  121. package/src/types/Resolvers.ts +14 -6
  122. package/src/types/data/Errors.ts +10 -4
  123. package/src/types/data/Service.ts +28 -11
  124. package/src/types/data/Tweet.ts +109 -31
  125. package/src/types/data/User.ts +47 -17
@@ -0,0 +1,27 @@
1
+ name: build-documentation
2
+ run-name: Building the documentation for the release
3
+ on:
4
+ push:
5
+ branches:
6
+ release
7
+ jobs:
8
+ documentation:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - uses: actions/setup-node@v3
15
+ with:
16
+ node-version: '18.x'
17
+ # Installing dependencies
18
+ - run: npm install
19
+
20
+ # Generating documentations
21
+ - run: npx typedoc src/index.ts
22
+
23
+ # Commiting the documentations
24
+ - uses: stefanzweifel/git-auto-commit-action@v4
25
+ with:
26
+ commit_message: Updated documentations
27
+ branch: release
package/README.md CHANGED
@@ -7,6 +7,8 @@ An API for fetching data from TwitterAPI, without any rate limits!
7
7
 
8
8
  #### **The API can either be used as a GraphQL Server or as a standalone npm library**
9
9
 
10
+ #### **For complete documentation and API reference, head over to the [documentation](https://rishikant181.github.io/Rettiwt-API/)**
11
+
10
12
  ## 1. GraphQL Server
11
13
  Using the API as a GraphQL enables complex nested queries to fetch data from twitter.
12
14
  To use the API as a server,
@@ -30,7 +32,7 @@ To use the API as an npm package,
30
32
  1. In your node project, install the package using 'npm install --save rettiwt-api'.
31
33
  2. import { Rettiwt } from 'rettiwt-api'.
32
34
  3. const rettiwt = Rettiwt().
33
- 4. Use the created Rettiwt instance to fetch data from Twitter.
35
+ 4. Use the created [Rettiwt](https://rishikant181.github.io/Rettiwt-API/functions/Rettiwt.html) instance to fetch data from Twitter.
34
36
 
35
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.
36
38
 
package/dist/Test.d.ts ADDED
File without changes
package/dist/Test.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=Test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Test.js","sourceRoot":"","sources":["../src/Test.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -2,15 +2,26 @@ import { UserService } from "./services/data/UserService";
2
2
  import { TweetService } from "./services/data/TweetService";
3
3
  import { AccountService } from "./services/accounts/AccountService";
4
4
  /**
5
- * @param cookie The cookies string to use to fetch data
5
+ * @param cookie The cookie string to use to fetch data
6
6
  * @returns The API for fetching user and tweet data
7
+ * @remarks The cookie can be obtained by using {@link AccountService.login} method.
8
+ * To use the {@link AccountService.login} method, create a {@link Rettiwt} instance without passing any cookie string.
9
+ * Then use the {@link AccountService.login} method of {@link AccountService} to get the cookie.
7
10
  */
8
11
  export declare const Rettiwt: (cookie?: string) => {
9
12
  users: UserService;
10
13
  tweets: TweetService;
11
14
  account: AccountService;
12
15
  };
13
- export { User } from './types/data/User';
14
- export { Tweet, TweetEntities, TweetFilter } from './types/data/Tweet';
15
- export { Cursor, CursoredData } from './types/data/Service';
16
- export { AuthenticationErrors, ValidationErrors, DataErrors } from './types/data/Errors';
16
+ export * from './services/AuthService';
17
+ export * from './services/CacheService';
18
+ export * from './services/FetcherService';
19
+ export * from './services/accounts/AccountService';
20
+ export * from './services/data/TweetService';
21
+ export * from './services/data/UserService';
22
+ export * from './types/data/Errors';
23
+ export * from './types/data/Service';
24
+ export * from './types/data/Tweet';
25
+ export * from './types/data/User';
26
+ export * from './types/Authentication';
27
+ export * from './types/HTTP';
package/dist/index.js CHANGED
@@ -10,16 +10,22 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
13
16
  exports.__esModule = true;
14
- exports.DataErrors = exports.ValidationErrors = exports.AuthenticationErrors = exports.Cursor = exports.Rettiwt = void 0;
17
+ exports.Rettiwt = void 0;
15
18
  // SERVICES
16
19
  var AuthService_1 = require("./services/AuthService");
17
20
  var UserService_1 = require("./services/data/UserService");
18
21
  var TweetService_1 = require("./services/data/TweetService");
19
22
  var AccountService_1 = require("./services/accounts/AccountService");
20
23
  /**
21
- * @param cookie The cookies string to use to fetch data
24
+ * @param cookie The cookie string to use to fetch data
22
25
  * @returns The API for fetching user and tweet data
26
+ * @remarks The cookie can be obtained by using {@link AccountService.login} method.
27
+ * To use the {@link AccountService.login} method, create a {@link Rettiwt} instance without passing any cookie string.
28
+ * Then use the {@link AccountService.login} method of {@link AccountService} to get the cookie.
23
29
  */
24
30
  var Rettiwt = function (cookie) {
25
31
  if (cookie === void 0) { cookie = ''; }
@@ -33,10 +39,18 @@ var Rettiwt = function (cookie) {
33
39
  };
34
40
  };
35
41
  exports.Rettiwt = Rettiwt;
36
- var Service_1 = require("./types/data/Service");
37
- __createBinding(exports, Service_1, "Cursor");
38
- var Errors_1 = require("./types/data/Errors");
39
- __createBinding(exports, Errors_1, "AuthenticationErrors");
40
- __createBinding(exports, Errors_1, "ValidationErrors");
41
- __createBinding(exports, Errors_1, "DataErrors");
42
+ // Exporting classes
43
+ __exportStar(require("./services/AuthService"), exports);
44
+ __exportStar(require("./services/CacheService"), exports);
45
+ __exportStar(require("./services/FetcherService"), exports);
46
+ __exportStar(require("./services/accounts/AccountService"), exports);
47
+ __exportStar(require("./services/data/TweetService"), exports);
48
+ __exportStar(require("./services/data/UserService"), exports);
49
+ // Exporting types
50
+ __exportStar(require("./types/data/Errors"), exports);
51
+ __exportStar(require("./types/data/Service"), exports);
52
+ __exportStar(require("./types/data/Tweet"), exports);
53
+ __exportStar(require("./types/data/User"), exports);
54
+ __exportStar(require("./types/Authentication"), exports);
55
+ __exportStar(require("./types/HTTP"), exports);
42
56
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,WAAW;AACX,sDAAqD;AACrD,2DAA0D;AAC1D,6DAA4D;AAC5D,qEAAoE;AAEpE;;;GAGG;AACI,IAAM,OAAO,GAAG,UAAC,MAAmB;IAAnB,uBAAA,EAAA,WAAmB;IACvC,mEAAmE;IACnE,IAAM,IAAI,GAAgB,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;IAElD,oEAAoE;IACpE,OAAO;QACH,KAAK,EAAE,IAAI,yBAAW,CAAC,IAAI,CAAC;QAC5B,MAAM,EAAE,IAAI,2BAAY,CAAC,IAAI,CAAC;QAC9B,OAAO,EAAE,IAAI,+BAAc,EAAE;KAChC,CAAC;AACN,CAAC,CAAA;AAVY,QAAA,OAAO,WAUnB;AAKD,gDAA4D;AAAnD,8CAAM;AACf,8CAAyF;AAAhF,2DAAoB;AAAE,uDAAgB;AAAE,iDAAU"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,sDAAqD;AACrD,2DAA0D;AAC1D,6DAA4D;AAC5D,qEAAoE;AAEpE;;;;;;GAMG;AACI,IAAM,OAAO,GAAG,UAAC,MAAmB;IAAnB,uBAAA,EAAA,WAAmB;IACvC,mEAAmE;IACnE,IAAM,IAAI,GAAgB,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;IAElD,oEAAoE;IACpE,OAAO;QACH,KAAK,EAAE,IAAI,yBAAW,CAAC,IAAI,CAAC;QAC5B,MAAM,EAAE,IAAI,2BAAY,CAAC,IAAI,CAAC;QAC9B,OAAO,EAAE,IAAI,+BAAc,EAAE;KAChC,CAAC;AACN,CAAC,CAAA;AAVY,QAAA,OAAO,WAUnB;AAED,oBAAoB;AACpB,yDAAuC;AACvC,0DAAwC;AACxC,4DAA0C;AAC1C,qEAAmD;AACnD,+DAA6C;AAC7C,8DAA4C;AAE5C,kBAAkB;AAClB,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,oDAAkC;AAClC,yDAAuC;AACvC,+CAA6B"}
@@ -0,0 +1,4 @@
1
+ import { GraphQLObjectType } from "graphql";
2
+ export declare const Cursor: GraphQLObjectType<any, any, {
3
+ [key: string]: any;
4
+ }>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Cursor = void 0;
4
+ // PACKAGE
5
+ var graphql_1 = require("graphql");
6
+ exports.Cursor = new graphql_1.GraphQLObjectType({
7
+ name: 'Cursor',
8
+ description: 'Cursor data for the next batch of list data',
9
+ fields: function () { return ({
10
+ value: { type: graphql_1.GraphQLString }
11
+ }); }
12
+ });
13
+ //# sourceMappingURL=Global.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Global.js","sourceRoot":"","sources":["../../../src/models/graphql/Global.ts"],"names":[],"mappings":";;;AAAA,UAAU;AACV,mCAA4D;AAE/C,QAAA,MAAM,GAAG,IAAI,2BAAiB,CAAC;IACxC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,6CAA6C;IAC1D,MAAM,EAAE,cAAM,OAAA,CAAC;QACX,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;KACjC,CAAC,EAFY,CAEZ;CACL,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { GraphQLList, GraphQLObjectType } from "graphql";
2
+ export declare const TweetTokens: GraphQLObjectType<any, any, {
3
+ [key: string]: any;
4
+ }>;
5
+ export declare const Tweet: any;
6
+ export declare const TweetList: GraphQLList<import("graphql").GraphQLType>;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ exports.TweetList = exports.Tweet = exports.TweetTokens = void 0;
7
+ // PACKAGE
8
+ var graphql_1 = require("graphql");
9
+ // TYPES
10
+ var UserTypes_1 = require("./UserTypes");
11
+ var Global_1 = require("./Global");
12
+ // RESOLVERS
13
+ var TweetResolver_1 = __importDefault(require("../../resolvers/TweetResolver"));
14
+ var UserResolver_1 = __importDefault(require("../../resolvers/UserResolver"));
15
+ //@ts-ignore
16
+ exports.TweetTokens = new graphql_1.GraphQLObjectType({
17
+ name: 'TweetTokens',
18
+ description: 'Additional extracted tokens from the tweet like mentions, hashtags, etc',
19
+ fields: function () { return ({
20
+ hashtags: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
21
+ urls: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
22
+ mentionedUsers: {
23
+ type: UserTypes_1.UserList,
24
+ resolve: function (parent, args, context) { return parent.mentionedUsers.map(function (user) { return new UserResolver_1["default"](context).resolveUserDetails('', user); }); }
25
+ },
26
+ media: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) }
27
+ }); }
28
+ });
29
+ //@ts-ignore
30
+ exports.Tweet = new graphql_1.GraphQLObjectType({
31
+ name: 'Tweet',
32
+ description: 'The details of single tweet',
33
+ fields: function () { return ({
34
+ id: { type: graphql_1.GraphQLString },
35
+ tweetBy: {
36
+ type: UserTypes_1.User,
37
+ resolve: function (parent, args, context) { return new UserResolver_1["default"](context).resolveUserDetails('', parent.tweetBy); }
38
+ },
39
+ createdAt: { type: graphql_1.GraphQLString },
40
+ entities: { type: exports.TweetTokens },
41
+ quoted: {
42
+ type: exports.Tweet,
43
+ resolve: function (parent, args, context) { return parent.quoted ? new TweetResolver_1["default"](context).resolveTweet(parent.quoted) : undefined; }
44
+ },
45
+ fullText: { type: graphql_1.GraphQLString },
46
+ replyTo: {
47
+ type: exports.Tweet,
48
+ resolve: function (parent, args, context) { return parent.replyTo ? new TweetResolver_1["default"](context).resolveTweet(parent.replyTo) : undefined; }
49
+ },
50
+ lang: { type: graphql_1.GraphQLString },
51
+ quoteCount: { type: graphql_1.GraphQLInt },
52
+ quotes: {
53
+ type: exports.TweetList,
54
+ args: {
55
+ count: {
56
+ type: graphql_1.GraphQLInt,
57
+ description: "The number of quotes to fetch",
58
+ defaultValue: 10
59
+ },
60
+ all: {
61
+ type: graphql_1.GraphQLBoolean,
62
+ description: "Whether to fetch all quotes",
63
+ defaultValue: false
64
+ },
65
+ cursor: {
66
+ type: graphql_1.GraphQLString,
67
+ description: 'The cursor to the batch of quotes list to fetch',
68
+ defaultValue: ''
69
+ }
70
+ },
71
+ resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweetQuotes(parent.id, args.count, args.all, args.cursor, parent.quoteCount); }
72
+ },
73
+ likeCount: { type: graphql_1.GraphQLInt },
74
+ likers: {
75
+ type: UserTypes_1.UserList,
76
+ args: {
77
+ count: {
78
+ type: graphql_1.GraphQLInt,
79
+ description: "The number of likers to fetch",
80
+ defaultValue: 10
81
+ },
82
+ all: {
83
+ type: graphql_1.GraphQLBoolean,
84
+ description: "Whether to fetch all likers",
85
+ defaultValue: false
86
+ },
87
+ cursor: {
88
+ type: graphql_1.GraphQLString,
89
+ description: 'The cursor to the batch of likers list to fetch',
90
+ defaultValue: ''
91
+ }
92
+ },
93
+ resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweetLikers(parent.id, args.count, args.all, args.cursor, parent.likeCount); }
94
+ },
95
+ retweetCount: { type: graphql_1.GraphQLInt },
96
+ retweeters: {
97
+ type: UserTypes_1.UserList,
98
+ args: {
99
+ count: {
100
+ type: graphql_1.GraphQLInt,
101
+ description: "The number of retweeters to fetch",
102
+ defaultValue: 10
103
+ },
104
+ all: {
105
+ type: graphql_1.GraphQLBoolean,
106
+ description: "Whether to fetch all likers",
107
+ defaultValue: false
108
+ },
109
+ cursor: {
110
+ type: graphql_1.GraphQLString,
111
+ description: 'The cursor to the batch of retweeters list to fetch',
112
+ defaultValue: ''
113
+ }
114
+ },
115
+ resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweetRetweeters(parent.id, args.count, args.all, args.cursor, parent.retweetCount); }
116
+ },
117
+ replyCount: { type: graphql_1.GraphQLInt },
118
+ replies: {
119
+ type: exports.TweetList,
120
+ args: {
121
+ count: {
122
+ type: graphql_1.GraphQLInt,
123
+ description: "The number of replies to fetch",
124
+ defaultValue: 10
125
+ },
126
+ all: {
127
+ type: graphql_1.GraphQLBoolean,
128
+ description: "Whether to fetch all replies",
129
+ defaultValue: false
130
+ },
131
+ cursor: {
132
+ type: graphql_1.GraphQLString,
133
+ description: 'The cursor to the batch of replies list to fetch',
134
+ defaultValue: ''
135
+ }
136
+ },
137
+ resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweetReplies(parent.id, args.count, args.all, args.cursor, parent.replyCount); }
138
+ }
139
+ }); }
140
+ });
141
+ exports.TweetList = new graphql_1.GraphQLList(new graphql_1.GraphQLUnionType({
142
+ name: 'TweetCursorUnion',
143
+ description: 'A union type which can either be a Tweet or a Cursor, used in cursored tweet lists',
144
+ types: [exports.Tweet, Global_1.Cursor],
145
+ resolveType: function (data) {
146
+ // If it has fullText field => this is a Tweet object
147
+ if (data.fullText) {
148
+ return exports.Tweet;
149
+ }
150
+ // If it has a value field => this is a cursor object
151
+ else if (data.value) {
152
+ return Global_1.Cursor;
153
+ }
154
+ }
155
+ }));
156
+ //# sourceMappingURL=TweetTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TweetTypes.js","sourceRoot":"","sources":["../../../src/models/graphql/TweetTypes.ts"],"names":[],"mappings":";;;;;;AAAA,UAAU;AACV,mCAAsH;AAEtH,QAAQ;AACR,yCAA6C;AAC7C,mCAAkC;AAElC,YAAY;AACZ,gFAA0D;AAC1D,8EAAwD;AAExD,YAAY;AACC,QAAA,WAAW,GAAG,IAAI,2BAAiB,CAAC;IAC7C,IAAI,EAAE,aAAa;IAC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@ -0,0 +1,3 @@
1
+ import { GraphQLList } from 'graphql';
2
+ export declare const User: any;
3
+ export declare const UserList: GraphQLList<import("graphql").GraphQLType>;
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ exports.UserList = exports.User = void 0;
7
+ // PACKAGE
8
+ var graphql_1 = require("graphql");
9
+ // TYPES
10
+ var TweetTypes_1 = require("./TweetTypes");
11
+ var Global_1 = require("./Global");
12
+ // RESOLVERS
13
+ var UserResolver_1 = __importDefault(require("../../resolvers/UserResolver"));
14
+ var TweetResolver_1 = __importDefault(require("../../resolvers/TweetResolver"));
15
+ //@ts-ignore
16
+ exports.User = new graphql_1.GraphQLObjectType({
17
+ name: 'User',
18
+ description: 'The details of a single target twitter user',
19
+ fields: function () { return ({
20
+ id: { type: graphql_1.GraphQLString },
21
+ userName: { type: graphql_1.GraphQLString },
22
+ fullName: { type: graphql_1.GraphQLString },
23
+ createdAt: { type: graphql_1.GraphQLString },
24
+ description: { type: graphql_1.GraphQLString },
25
+ isVerified: { type: graphql_1.GraphQLBoolean },
26
+ location: { type: graphql_1.GraphQLString },
27
+ pinnedTweet: {
28
+ type: TweetTypes_1.Tweet,
29
+ resolve: function (parent, args, context) { return (parent.pinnedTweet) ? new TweetResolver_1["default"](context).resolveTweet(parent.pinnedTweet) : undefined; }
30
+ },
31
+ profileBanner: { type: graphql_1.GraphQLString },
32
+ profileImage: { type: graphql_1.GraphQLString },
33
+ favouritesCount: { type: graphql_1.GraphQLInt },
34
+ likes: {
35
+ type: TweetTypes_1.TweetList,
36
+ args: {
37
+ count: {
38
+ description: "The number of liked tweets to fetch",
39
+ type: graphql_1.GraphQLInt,
40
+ defaultValue: 10
41
+ },
42
+ all: {
43
+ description: "Whether to fetch all tweets liked by user",
44
+ type: graphql_1.GraphQLBoolean,
45
+ defaultValue: false
46
+ },
47
+ cursor: {
48
+ type: graphql_1.GraphQLString,
49
+ description: 'The cursor to the batch of likes list to fetch',
50
+ defaultValue: ''
51
+ }
52
+ },
53
+ resolve: function (parent, args, context) { return new UserResolver_1["default"](context).resolveUserLikes(parent.id, args.count, args.all, args.cursor, parent.favouritesCount); }
54
+ },
55
+ followersCount: { type: graphql_1.GraphQLInt },
56
+ followers: {
57
+ type: exports.UserList,
58
+ args: {
59
+ count: {
60
+ description: "The number of followers to fetch",
61
+ type: graphql_1.GraphQLInt,
62
+ defaultValue: 20
63
+ },
64
+ all: {
65
+ description: "Whether to fetch all followers list",
66
+ type: graphql_1.GraphQLBoolean,
67
+ defaultValue: false
68
+ },
69
+ cursor: {
70
+ type: graphql_1.GraphQLString,
71
+ description: 'The cursor to the batch of followers list to fetch',
72
+ defaultValue: ''
73
+ }
74
+ },
75
+ resolve: function (parent, args, context) { return new UserResolver_1["default"](context).resolveUserFollowers(parent.id, args.count, args.all, args.cursor, parent.followersCount); }
76
+ },
77
+ followingsCount: { type: graphql_1.GraphQLInt },
78
+ following: {
79
+ type: exports.UserList,
80
+ args: {
81
+ count: {
82
+ type: graphql_1.GraphQLInt,
83
+ description: "The number of followings to fetch",
84
+ defaultValue: 20
85
+ },
86
+ all: {
87
+ description: "Whether to fetch all followings list",
88
+ type: graphql_1.GraphQLBoolean,
89
+ defaultValue: false
90
+ },
91
+ cursor: {
92
+ type: graphql_1.GraphQLString,
93
+ description: 'The cursor to the batch of followers list to fetch',
94
+ defaultValue: ''
95
+ }
96
+ },
97
+ resolve: function (parent, args, context) { return new UserResolver_1["default"](context).resolveUserFollowing(parent.id, args.count, args.all, args.cursor, parent.followingsCount); }
98
+ },
99
+ statusesCount: { type: graphql_1.GraphQLInt },
100
+ tweets: {
101
+ type: TweetTypes_1.TweetList,
102
+ args: {
103
+ count: {
104
+ description: "The number of tweets to fetch",
105
+ type: graphql_1.GraphQLInt,
106
+ defaultValue: 10
107
+ },
108
+ all: {
109
+ description: "Whether to fetch all tweets made by user",
110
+ type: graphql_1.GraphQLBoolean,
111
+ defaultValue: false
112
+ },
113
+ cursor: {
114
+ type: graphql_1.GraphQLString,
115
+ description: 'The cursor to the batch of tweets list to fetch',
116
+ defaultValue: ''
117
+ }
118
+ },
119
+ resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweets({ fromUsers: [parent.userName] }, args.count, args.cursor); }
120
+ }
121
+ }); }
122
+ });
123
+ //@ts-ignore
124
+ exports.UserList = new graphql_1.GraphQLList(new graphql_1.GraphQLUnionType({
125
+ name: 'UserCursorUnion',
126
+ description: 'A union type which can either be a User or a Cursor, used in cursored User lists',
127
+ types: [exports.User, Global_1.Cursor],
128
+ resolveType: function (data) {
129
+ // If it has a userName field => this is a User object
130
+ if (data.userName) {
131
+ return exports.User;
132
+ }
133
+ // If it has a value field => this is a Cursor object
134
+ else if (data.value) {
135
+ return Global_1.Cursor;
136
+ }
137
+ }
138
+ }));
139
+ //# sourceMappingURL=UserTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserTypes.js","sourceRoot":"","sources":["../../../src/models/graphql/UserTypes.ts"],"names":[],"mappings":";;;;;;AAAA,UAAU;AACV,mCAAsH;AAEtH,QAAQ;AACR,2CAA+C;AAC/C,mCAAkC;AAGlC,YAAY;AACZ,8EAAwD;AACxD,gFAA0D;AAE1D,YAAY;AACC,QAAA,IAAI,GAAG,IAAI,2BAAiB,CAAC;IACtC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,6CAA6C;IAC1D,MAAM,EAAE,cAAM,OAAA,CAAC;QACX,EAAE,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;QACjC,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;QACjC,SAAS,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;QAClC,WAAW,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;QACpC,UAAU,EAAE,EA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QLObjectType<any, any, {
3
+ [key: string]: any;
4
+ }>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ exports.rootQuery = void 0;
7
+ // PACKAGE
8
+ var graphql_1 = require("graphql");
9
+ // TYPES
10
+ var UserTypes_1 = require("../models/graphql/UserTypes");
11
+ var TweetTypes_1 = require("../models/graphql/TweetTypes");
12
+ // RESOLVERS
13
+ var UserResolver_1 = __importDefault(require("../resolvers/UserResolver"));
14
+ var TweetResolver_1 = __importDefault(require("../resolvers/TweetResolver"));
15
+ var AccountResolver_1 = __importDefault(require("../resolvers/AccountResolver"));
16
+ exports.rootQuery = new graphql_1.GraphQLObjectType({
17
+ name: 'Root',
18
+ fields: {
19
+ test: {
20
+ type: graphql_1.GraphQLString,
21
+ resolve: function () { return "GraphQL Works!"; }
22
+ },
23
+ User: {
24
+ type: UserTypes_1.User,
25
+ description: "Returns the details of the twitter user with given user name",
26
+ args: {
27
+ userName: { type: graphql_1.GraphQLString },
28
+ id: { type: graphql_1.GraphQLString }
29
+ },
30
+ resolve: function (parent, args, context) { return new UserResolver_1["default"](context).resolveUserDetails(args.userName, args.id); }
31
+ },
32
+ Tweet: {
33
+ type: TweetTypes_1.Tweet,
34
+ description: "Returns a single tweet given it's id",
35
+ args: {
36
+ id: { type: graphql_1.GraphQLString }
37
+ },
38
+ resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweet(args.id); }
39
+ },
40
+ Tweets: {
41
+ type: TweetTypes_1.TweetList,
42
+ description: "Returns the list of tweets matching the given criteria",
43
+ args: {
44
+ fromUsers: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
45
+ toUsers: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
46
+ mentions: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
47
+ hashtags: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
48
+ words: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
49
+ startDate: { type: graphql_1.GraphQLString },
50
+ endDate: { type: graphql_1.GraphQLString },
51
+ quoted: { type: graphql_1.GraphQLString },
52
+ links: { type: graphql_1.GraphQLBoolean, defaultValue: false },
53
+ count: { type: graphql_1.GraphQLInt, defaultValue: 20 },
54
+ cursor: { type: graphql_1.GraphQLString, defaultValue: '' }
55
+ },
56
+ resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweets(args, args.count, args.cursor); }
57
+ },
58
+ Login: {
59
+ type: graphql_1.GraphQLString,
60
+ description: "Returns the cookies that can be used to fetch data from twitter",
61
+ args: {
62
+ email: { type: graphql_1.GraphQLString },
63
+ userName: { type: graphql_1.GraphQLString },
64
+ password: { type: graphql_1.GraphQLString }
65
+ },
66
+ resolve: function (parent, args, context) { return new AccountResolver_1["default"](context).resolveLogin(args.email, args.userName, args.password); }
67
+ }
68
+ }
69
+ });
70
+ //# sourceMappingURL=RootQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootQuery.js","sourceRoot":"","sources":["../../src/queries/RootQuery.ts"],"names":[],"mappings":";;;;;;AAAA,UAAU;AACV,mCAAmG;AAEnG,QAAQ;AACR,yDAAmD;AACnD,2DAAgE;AAGhE,YAAY;AACZ,2EAAqD;AACrD,6EAAuD;AACvD,iFAA2D;AAE9C,QAAA,SAAS,GAAG,IAAI,2BAAiB,CAAC;IAC3C,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE;QACJ,IAAI,EAAE;YACF,IAAI,EAAE,uBAAa;YACnB,OAAO,EAAE,cAAM,OAAA,gBAAgB,EAAhB,CAAgB;SAClC;QACD,IAAI,EAAE;YACF,IAAI,EAAE,gBAAI;YACV,WAAW,EAAE,8DAA8D;YAC3E,IAAI,EAAE;gBACF,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;gBACjC,EAAE,EAAE,EAAE,IAAI,EAAE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,EAAE,oBAAU,EAAE,YAAY,EAAE,EAAE,EAAE;gBAC7C,MAAM,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE,YAAY,EAAE,EAAE,EAAE;aACpD;YACD,OAAO,EAAE,UAAC,MAAM,EAAE,IAAI,EAAE,OAAO,IAAK,OAAA,IAAI,0BAAa,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,IAAmB,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAtF,CAAsF;SAC7H;QACD,KAAK,EAAE;YACH,IAAI,EAAE,uBAAa;YACnB,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"}
@@ -0,0 +1,12 @@
1
+ import ResolverBase from './ResolverBase';
2
+ import { DataContext } from '../types/Service';
3
+ export default class AccountResolver extends ResolverBase {
4
+ constructor(context: DataContext);
5
+ /**
6
+ * @param email The email of the account to be logged into
7
+ * @param userName The username associated with the account
8
+ * @param password The password to the account
9
+ * @returns The cookie string that can be used to authenticate against twitter
10
+ */
11
+ resolveLogin(email: string, userName: string, password: string): Promise<string>;
12
+ }