rettiwt-api 1.4.0 → 2.0.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.
- package/.eslintignore +3 -0
- package/.eslintrc.js +54 -0
- package/.github/workflows/documentation.yml +29 -9
- package/.github/workflows/publish.yml +8 -3
- package/.prettierignore +3 -0
- package/.prettierrc +13 -0
- package/README.md +59 -61
- package/dist/Rettiwt.d.ts +19 -0
- package/dist/Rettiwt.js +30 -0
- package/dist/Rettiwt.js.map +1 -0
- package/dist/enums/ApiErrors.d.ts +30 -0
- package/dist/enums/ApiErrors.js +35 -0
- package/dist/enums/ApiErrors.js.map +1 -0
- package/dist/enums/HTTP.d.ts +11 -11
- package/dist/enums/HTTP.js +15 -16
- package/dist/enums/HTTP.js.map +1 -1
- package/dist/helper/JsonUtils.d.ts +26 -0
- package/dist/helper/JsonUtils.js +88 -0
- package/dist/helper/JsonUtils.js.map +1 -0
- package/dist/index.d.ts +10 -43
- package/dist/index.js +16 -55
- package/dist/index.js.map +1 -1
- package/dist/models/CursoredData.d.ts +37 -0
- package/dist/models/CursoredData.js +59 -0
- package/dist/models/CursoredData.js.map +1 -0
- package/dist/models/{data/Tweet.d.ts → Tweet.d.ts} +4 -4
- package/dist/models/{data/Tweet.js → Tweet.js} +7 -32
- package/dist/models/Tweet.js.map +1 -0
- package/dist/models/{data/User.d.ts → User.d.ts} +3 -3
- package/dist/models/{data/User.js → User.js} +3 -3
- package/dist/models/User.js.map +1 -0
- package/dist/services/FetcherService.d.ts +66 -0
- package/dist/services/FetcherService.js +209 -0
- package/dist/services/FetcherService.js.map +1 -0
- package/dist/services/TweetService.d.ts +88 -0
- package/dist/services/TweetService.js +244 -0
- package/dist/services/TweetService.js.map +1 -0
- package/dist/services/UserService.d.ts +60 -0
- package/dist/services/UserService.js +188 -0
- package/dist/services/UserService.js.map +1 -0
- package/dist/types/{Service.d.ts → CursoredData.d.ts} +3 -3
- package/dist/types/CursoredData.js +3 -0
- package/dist/types/CursoredData.js.map +1 -0
- package/dist/types/Tweet.js +1 -1
- package/dist/types/User.js +1 -1
- package/package.json +15 -19
- package/src/Rettiwt.ts +33 -0
- package/src/enums/ApiErrors.ts +30 -0
- package/src/enums/HTTP.ts +12 -12
- package/src/helper/JsonUtils.ts +86 -0
- package/src/index.ts +14 -57
- package/src/models/CursoredData.ts +64 -0
- package/src/models/Tweet.ts +116 -0
- package/src/models/User.ts +72 -0
- package/src/services/FetcherService.ts +186 -0
- package/src/services/TweetService.ts +153 -0
- package/src/services/UserService.ts +117 -0
- package/src/types/CursoredData.ts +24 -0
- package/src/types/Tweet.ts +35 -35
- package/src/types/User.ts +30 -30
- package/tsconfig.json +9 -9
- package/dist/config/env.d.ts +0 -5
- package/dist/config/env.js +0 -9
- package/dist/config/env.js.map +0 -1
- package/dist/enums/Errors.d.ts +0 -21
- package/dist/enums/Errors.js +0 -29
- package/dist/enums/Errors.js.map +0 -1
- package/dist/graphql/enums/Errors.d.ts +0 -21
- package/dist/graphql/enums/Errors.js +0 -29
- package/dist/graphql/enums/Errors.js.map +0 -1
- package/dist/graphql/queries/RootQuery.d.ts +0 -4
- package/dist/graphql/queries/RootQuery.js +0 -83
- package/dist/graphql/queries/RootQuery.js.map +0 -1
- package/dist/graphql/resolvers/AccountResolver.d.ts +0 -12
- package/dist/graphql/resolvers/AccountResolver.js +0 -84
- package/dist/graphql/resolvers/AccountResolver.js.map +0 -1
- package/dist/graphql/resolvers/ResolverBase.d.ts +0 -16
- package/dist/graphql/resolvers/ResolverBase.js +0 -23
- package/dist/graphql/resolvers/ResolverBase.js.map +0 -1
- package/dist/graphql/resolvers/TweetResolver.d.ts +0 -46
- package/dist/graphql/resolvers/TweetResolver.js +0 -302
- package/dist/graphql/resolvers/TweetResolver.js.map +0 -1
- package/dist/graphql/resolvers/UserResolver.d.ts +0 -48
- package/dist/graphql/resolvers/UserResolver.js +0 -334
- package/dist/graphql/resolvers/UserResolver.js.map +0 -1
- package/dist/graphql/types/Global.d.ts +0 -4
- package/dist/graphql/types/Global.js +0 -13
- package/dist/graphql/types/Global.js.map +0 -1
- package/dist/graphql/types/TweetTypes.d.ts +0 -4
- package/dist/graphql/types/TweetTypes.js +0 -160
- package/dist/graphql/types/TweetTypes.js.map +0 -1
- package/dist/graphql/types/UserTypes.d.ts +0 -3
- package/dist/graphql/types/UserTypes.js +0 -137
- package/dist/graphql/types/UserTypes.js.map +0 -1
- package/dist/models/args/TweetListArgs.d.ts +0 -21
- package/dist/models/args/TweetListArgs.js +0 -54
- package/dist/models/args/TweetListArgs.js.map +0 -1
- package/dist/models/args/UserListArgs.d.ts +0 -21
- package/dist/models/args/UserListArgs.js +0 -54
- package/dist/models/args/UserListArgs.js.map +0 -1
- package/dist/models/auth/AuthCookie.d.ts +0 -21
- package/dist/models/auth/AuthCookie.js +0 -33
- package/dist/models/auth/AuthCookie.js.map +0 -1
- package/dist/models/data/CursoredData.d.ts +0 -34
- package/dist/models/data/CursoredData.js +0 -42
- package/dist/models/data/CursoredData.js.map +0 -1
- package/dist/models/data/Tweet.js.map +0 -1
- package/dist/models/data/User.js.map +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -76
- package/dist/server.js.map +0 -1
- package/dist/services/auth/AccountService.d.ts +0 -83
- package/dist/services/auth/AccountService.js +0 -412
- package/dist/services/auth/AccountService.js.map +0 -1
- package/dist/services/auth/AuthService.d.ts +0 -31
- package/dist/services/auth/AuthService.js +0 -118
- package/dist/services/auth/AuthService.js.map +0 -1
- package/dist/services/data/TweetService.d.ts +0 -60
- package/dist/services/data/TweetService.js +0 -250
- package/dist/services/data/TweetService.js.map +0 -1
- package/dist/services/data/UserService.d.ts +0 -71
- package/dist/services/data/UserService.js +0 -278
- package/dist/services/data/UserService.js.map +0 -1
- package/dist/services/helper/Headers.d.ts +0 -19
- package/dist/services/helper/Headers.js +0 -62
- package/dist/services/helper/Headers.js.map +0 -1
- package/dist/services/helper/Parser.d.ts +0 -22
- package/dist/services/helper/Parser.js +0 -84
- package/dist/services/helper/Parser.js.map +0 -1
- package/dist/services/helper/extractors/Tweets.d.ts +0 -23
- package/dist/services/helper/extractors/Tweets.js +0 -200
- package/dist/services/helper/extractors/Tweets.js.map +0 -1
- package/dist/services/helper/extractors/Users.d.ts +0 -17
- package/dist/services/helper/extractors/Users.js +0 -151
- package/dist/services/helper/extractors/Users.js.map +0 -1
- package/dist/services/helper/payloads/LoginFlows.d.ts +0 -77
- package/dist/services/helper/payloads/LoginFlows.js +0 -92
- package/dist/services/helper/payloads/LoginFlows.js.map +0 -1
- package/dist/services/helper/urls/Authentication.d.ts +0 -4
- package/dist/services/helper/urls/Authentication.js +0 -11
- package/dist/services/helper/urls/Authentication.js.map +0 -1
- package/dist/services/util/CacheService.d.ts +0 -33
- package/dist/services/util/CacheService.js +0 -96
- package/dist/services/util/CacheService.js.map +0 -1
- package/dist/services/util/FetcherService.d.ts +0 -65
- package/dist/services/util/FetcherService.js +0 -202
- package/dist/services/util/FetcherService.js.map +0 -1
- package/dist/types/Args.d.ts +0 -11
- package/dist/types/Args.js +0 -4
- package/dist/types/Args.js.map +0 -1
- package/dist/types/Authentication.d.ts +0 -55
- package/dist/types/Authentication.js +0 -6
- package/dist/types/Authentication.js.map +0 -1
- package/dist/types/Resolvers.d.ts +0 -15
- package/dist/types/Resolvers.js +0 -3
- package/dist/types/Resolvers.js.map +0 -1
- package/dist/types/Rettiwt.d.ts +0 -16
- package/dist/types/Rettiwt.js +0 -3
- package/dist/types/Rettiwt.js.map +0 -1
- package/dist/types/Service.js +0 -5
- package/dist/types/Service.js.map +0 -1
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -64
- package/docs/assets/main.js +0 -58
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1280
- package/docs/classes/AccountService.html +0 -286
- package/docs/classes/AuthCookie.html +0 -146
- package/docs/classes/AuthService.html +0 -147
- package/docs/classes/CacheService.html +0 -157
- package/docs/classes/Cursor.html +0 -102
- package/docs/classes/CursoredData.html +0 -126
- package/docs/classes/DataValidationError.html +0 -120
- package/docs/classes/FetcherService.html +0 -225
- package/docs/classes/Tweet.html +0 -210
- package/docs/classes/TweetEntities.html +0 -128
- package/docs/classes/TweetFilter.html +0 -233
- package/docs/classes/TweetListArgs.html +0 -118
- package/docs/classes/TweetService.html +0 -319
- package/docs/classes/User.html +0 -230
- package/docs/classes/UserListArgs.html +0 -118
- package/docs/classes/UserService.html +0 -355
- package/docs/enums/HttpMethods.html +0 -74
- package/docs/functions/Rettiwt.html +0 -100
- package/docs/index.html +0 -159
- package/docs/interfaces/IAuthCookie.html +0 -104
- package/docs/interfaces/ICursor.html +0 -77
- package/docs/interfaces/ICursoredData.html +0 -93
- package/docs/interfaces/IDataContext.html +0 -91
- package/docs/interfaces/IDataValidationError.html +0 -109
- package/docs/interfaces/IListArgs.html +0 -87
- package/docs/interfaces/ITweet.html +0 -176
- package/docs/interfaces/ITweetEntities.html +0 -104
- package/docs/interfaces/ITweetFilter.html +0 -158
- package/docs/interfaces/IUser.html +0 -194
- package/docs/modules.html +0 -111
- package/environment.d.ts +0 -11
- package/src/config/env.ts +0 -5
- package/src/enums/Errors.ts +0 -22
- package/src/graphql/enums/Errors.ts +0 -22
- package/src/graphql/queries/RootQuery.ts +0 -81
- package/src/graphql/resolvers/AccountResolver.ts +0 -22
- package/src/graphql/resolvers/ResolverBase.ts +0 -26
- package/src/graphql/resolvers/TweetResolver.ts +0 -225
- package/src/graphql/resolvers/UserResolver.ts +0 -257
- package/src/graphql/types/Global.ts +0 -10
- package/src/graphql/types/TweetTypes.ts +0 -158
- package/src/graphql/types/UserTypes.ts +0 -134
- package/src/models/args/TweetListArgs.ts +0 -47
- package/src/models/args/UserListArgs.ts +0 -47
- package/src/models/auth/AuthCookie.ts +0 -43
- package/src/models/data/CursoredData.ts +0 -45
- package/src/models/data/Tweet.ts +0 -118
- package/src/models/data/User.ts +0 -72
- package/src/server.ts +0 -37
- package/src/services/auth/AccountService.ts +0 -283
- package/src/services/auth/AuthService.ts +0 -81
- package/src/services/data/TweetService.ts +0 -197
- package/src/services/data/UserService.ts +0 -221
- package/src/services/helper/Headers.ts +0 -60
- package/src/services/helper/Parser.ts +0 -89
- package/src/services/helper/extractors/Tweets.ts +0 -190
- package/src/services/helper/extractors/Users.ts +0 -141
- package/src/services/helper/payloads/LoginFlows.ts +0 -90
- package/src/services/helper/urls/Authentication.ts +0 -6
- package/src/services/util/CacheService.ts +0 -76
- package/src/services/util/FetcherService.ts +0 -143
- package/src/types/Args.ts +0 -12
- package/src/types/Authentication.ts +0 -63
- package/src/types/Resolvers.ts +0 -18
- package/src/types/Rettiwt.ts +0 -20
- package/src/types/Service.ts +0 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,45 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param cookie The cookie to use to fetch data.
|
|
12
|
-
*
|
|
13
|
-
* @returns The API for fetching user and tweet data.
|
|
14
|
-
*
|
|
15
|
-
* @remarks The cookie can be obtained by using {@link AccountService.login} method.
|
|
16
|
-
* To use the {@link AccountService.login} method, create a {@link Rettiwt} instance without passing any cookie .
|
|
17
|
-
* Then use the {@link AccountService.login} method of {@link AccountService} to get the cookie.
|
|
18
|
-
*/
|
|
19
|
-
export declare const Rettiwt: (cookie?: IAuthCookie | undefined) => {
|
|
20
|
-
users: UserService;
|
|
21
|
-
tweets: TweetService;
|
|
22
|
-
account: AccountService;
|
|
23
|
-
};
|
|
24
|
-
export * from './services/auth/AuthService';
|
|
25
|
-
export * from './services/auth/AccountService';
|
|
26
|
-
export * from './services/data/TweetService';
|
|
27
|
-
export * from './services/data/UserService';
|
|
28
|
-
export * from './services/util/CacheService';
|
|
29
|
-
export * from './services/util/FetcherService';
|
|
30
|
-
export { ITweetFilter } from 'rettiwt-core';
|
|
31
|
-
export * from './types/Args';
|
|
32
|
-
export { IAuthCookie } from './types/Authentication';
|
|
33
|
-
export * from './types/Rettiwt';
|
|
34
|
-
export * from './types/Service';
|
|
1
|
+
export * from './Rettiwt';
|
|
2
|
+
export * from './enums/ApiErrors';
|
|
3
|
+
export * from './enums/HTTP';
|
|
4
|
+
export * from './models/CursoredData';
|
|
5
|
+
export * from './models/Tweet';
|
|
6
|
+
export * from './models/User';
|
|
7
|
+
export * from './services/FetcherService';
|
|
8
|
+
export * from './services/TweetService';
|
|
9
|
+
export * from './services/UserService';
|
|
10
|
+
export * from './types/CursoredData';
|
|
35
11
|
export * from './types/Tweet';
|
|
36
12
|
export * from './types/User';
|
|
37
|
-
export { IDataValidationError } from 'rettiwt-core';
|
|
38
|
-
export { TweetFilter } from 'rettiwt-core';
|
|
39
|
-
export * from './models/args/TweetListArgs';
|
|
40
|
-
export * from './models/args/UserListArgs';
|
|
41
|
-
export { AuthCookie } from './models/auth/AuthCookie';
|
|
42
|
-
export * from './models/data/CursoredData';
|
|
43
|
-
export * from './models/data/Tweet';
|
|
44
|
-
export * from './models/data/User';
|
|
45
|
-
export { DataValidationError } from 'rettiwt-core';
|
package/dist/index.js
CHANGED
|
@@ -13,61 +13,22 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* @returns The API for fetching user and tweet data.
|
|
33
|
-
*
|
|
34
|
-
* @remarks The cookie can be obtained by using {@link AccountService.login} method.
|
|
35
|
-
* To use the {@link AccountService.login} method, create a {@link Rettiwt} instance without passing any cookie .
|
|
36
|
-
* Then use the {@link AccountService.login} method of {@link AccountService} to get the cookie.
|
|
37
|
-
*/
|
|
38
|
-
var Rettiwt = function (cookie) {
|
|
39
|
-
// Creating new auth service instance using the given cookie
|
|
40
|
-
var auth = new AuthService_1.AuthService(cookie);
|
|
41
|
-
// Using the auth service instance to create data services instances
|
|
42
|
-
return {
|
|
43
|
-
users: new UserService_1.UserService(auth),
|
|
44
|
-
tweets: new TweetService_1.TweetService(auth),
|
|
45
|
-
account: new AccountService_1.AccountService()
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
exports.Rettiwt = Rettiwt;
|
|
49
|
-
// Exporting classes
|
|
50
|
-
__exportStar(require("./services/auth/AuthService"), exports);
|
|
51
|
-
__exportStar(require("./services/auth/AccountService"), exports);
|
|
52
|
-
__exportStar(require("./services/data/TweetService"), exports);
|
|
53
|
-
__exportStar(require("./services/data/UserService"), exports);
|
|
54
|
-
__exportStar(require("./services/util/CacheService"), exports);
|
|
55
|
-
__exportStar(require("./services/util/FetcherService"), exports);
|
|
56
|
-
__exportStar(require("./types/Args"), exports);
|
|
57
|
-
__exportStar(require("./types/Rettiwt"), exports);
|
|
58
|
-
__exportStar(require("./types/Service"), exports);
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// MAIN
|
|
18
|
+
__exportStar(require("./Rettiwt"), exports);
|
|
19
|
+
// Exporting enums
|
|
20
|
+
__exportStar(require("./enums/ApiErrors"), exports);
|
|
21
|
+
__exportStar(require("./enums/HTTP"), exports);
|
|
22
|
+
// Exporting models
|
|
23
|
+
__exportStar(require("./models/CursoredData"), exports);
|
|
24
|
+
__exportStar(require("./models/Tweet"), exports);
|
|
25
|
+
__exportStar(require("./models/User"), exports);
|
|
26
|
+
// Exporting services
|
|
27
|
+
__exportStar(require("./services/FetcherService"), exports);
|
|
28
|
+
__exportStar(require("./services/TweetService"), exports);
|
|
29
|
+
__exportStar(require("./services/UserService"), exports);
|
|
30
|
+
// Exporting types
|
|
31
|
+
__exportStar(require("./types/CursoredData"), exports);
|
|
59
32
|
__exportStar(require("./types/Tweet"), exports);
|
|
60
33
|
__exportStar(require("./types/User"), exports);
|
|
61
|
-
// Exporting models
|
|
62
|
-
var rettiwt_core_1 = require("rettiwt-core");
|
|
63
|
-
__createBinding(exports, rettiwt_core_1, "TweetFilter");
|
|
64
|
-
__exportStar(require("./models/args/TweetListArgs"), exports);
|
|
65
|
-
__exportStar(require("./models/args/UserListArgs"), exports);
|
|
66
|
-
var AuthCookie_1 = require("./models/auth/AuthCookie");
|
|
67
|
-
__createBinding(exports, AuthCookie_1, "AuthCookie");
|
|
68
|
-
__exportStar(require("./models/data/CursoredData"), exports);
|
|
69
|
-
__exportStar(require("./models/data/Tweet"), exports);
|
|
70
|
-
__exportStar(require("./models/data/User"), exports);
|
|
71
|
-
var rettiwt_core_2 = require("rettiwt-core");
|
|
72
|
-
__createBinding(exports, rettiwt_core_2, "DataValidationError");
|
|
73
34
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO;AACP,4CAA0B;AAE1B,kBAAkB;AAClB,oDAAkC;AAClC,+CAA6B;AAE7B,mBAAmB;AACnB,wDAAsC;AACtC,iDAA+B;AAC/B,gDAA8B;AAE9B,qBAAqB;AACrB,4DAA0C;AAC1C,0DAAwC;AACxC,yDAAuC;AAEvC,kBAAkB;AAClB,uDAAqC;AACrC,gDAA8B;AAC9B,+CAA6B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ITweet as IRawTweet, IUser as IRawUser } from 'rettiwt-core';
|
|
2
|
+
import { Tweet } from './Tweet';
|
|
3
|
+
import { User } from './User';
|
|
4
|
+
import { ICursor, ICursoredData } from '../types/CursoredData';
|
|
5
|
+
/**
|
|
6
|
+
* The cursor to the batch of data to be fetched.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class Cursor implements ICursor {
|
|
11
|
+
/** The cursor string. */
|
|
12
|
+
value: string;
|
|
13
|
+
/**
|
|
14
|
+
* Initializes a new cursor from the given cursor string.
|
|
15
|
+
*
|
|
16
|
+
* @param cursorStr - The string representation of the cursor.
|
|
17
|
+
*/
|
|
18
|
+
constructor(cursorStr: string);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The data that us fetched batch-wise along with a cursor.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam T - Type of data to be stored in the list.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare class CursoredData<T extends Tweet | User> implements ICursoredData<T> {
|
|
28
|
+
/** The list of data of the given type. */
|
|
29
|
+
list: T[];
|
|
30
|
+
/** The cursor to the next batch of data. */
|
|
31
|
+
next: Cursor;
|
|
32
|
+
/**
|
|
33
|
+
* @param list - The list of data item to store.
|
|
34
|
+
* @param next - The cursor to the next batch of data.
|
|
35
|
+
*/
|
|
36
|
+
constructor(list?: (IRawTweet | IRawUser)[], next?: string);
|
|
37
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CursoredData = exports.Cursor = void 0;
|
|
4
|
+
// MODELS
|
|
5
|
+
var Tweet_1 = require("./Tweet");
|
|
6
|
+
var User_1 = require("./User");
|
|
7
|
+
/**
|
|
8
|
+
* The cursor to the batch of data to be fetched.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
var Cursor = /** @class */ (function () {
|
|
13
|
+
/**
|
|
14
|
+
* Initializes a new cursor from the given cursor string.
|
|
15
|
+
*
|
|
16
|
+
* @param cursorStr - The string representation of the cursor.
|
|
17
|
+
*/
|
|
18
|
+
function Cursor(cursorStr) {
|
|
19
|
+
this.value = cursorStr;
|
|
20
|
+
}
|
|
21
|
+
return Cursor;
|
|
22
|
+
}());
|
|
23
|
+
exports.Cursor = Cursor;
|
|
24
|
+
/**
|
|
25
|
+
* The data that us fetched batch-wise along with a cursor.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam T - Type of data to be stored in the list.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
var CursoredData = /** @class */ (function () {
|
|
32
|
+
/**
|
|
33
|
+
* @param list - The list of data item to store.
|
|
34
|
+
* @param next - The cursor to the next batch of data.
|
|
35
|
+
*/
|
|
36
|
+
function CursoredData(list, next) {
|
|
37
|
+
if (list === void 0) { list = []; }
|
|
38
|
+
if (next === void 0) { next = ''; }
|
|
39
|
+
/** The list of data of the given type. */
|
|
40
|
+
this.list = [];
|
|
41
|
+
// Deserializing the input raw data and storing it in the list
|
|
42
|
+
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
|
|
43
|
+
var item = list_1[_i];
|
|
44
|
+
// If the item is a valid raw tweet
|
|
45
|
+
if (item.__typename == 'Tweet' && item.rest_id) {
|
|
46
|
+
this.list.push(new Tweet_1.Tweet(item));
|
|
47
|
+
}
|
|
48
|
+
// If the item is a valid raw user
|
|
49
|
+
else if (item.__typename == 'User' && item.rest_id) {
|
|
50
|
+
this.list.push(new User_1.User(item));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Initializing cursors
|
|
54
|
+
this.next = new Cursor(next);
|
|
55
|
+
}
|
|
56
|
+
return CursoredData;
|
|
57
|
+
}());
|
|
58
|
+
exports.CursoredData = CursoredData;
|
|
59
|
+
//# sourceMappingURL=CursoredData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CursoredData.js","sourceRoot":"","sources":["../../src/models/CursoredData.ts"],"names":[],"mappings":";;;AAGA,SAAS;AACT,iCAAgC;AAChC,+BAA8B;AAK9B;;;;GAIG;AACH;IAIC;;;;OAIG;IACH,gBAAY,SAAiB;QAC5B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACxB,CAAC;IACF,aAAC;AAAD,CAAC,AAZD,IAYC;AAZY,wBAAM;AAcnB;;;;;;GAMG;AACH;IAOC;;;OAGG;IACH,sBAAY,IAAmC,EAAE,IAAiB;QAAtD,qBAAA,EAAA,SAAmC;QAAE,qBAAA,EAAA,SAAiB;QAVlE,0CAA0C;QAC1C,SAAI,GAAQ,EAAE,CAAC;QAUd,8DAA8D;QAC9D,KAAmB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAApB,IAAM,IAAI,aAAA;YACd,mCAAmC;YACnC,IAAI,IAAI,CAAC,UAAU,IAAI,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE;gBAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,aAAK,CAAC,IAAiB,CAAM,CAAC,CAAC;aAClD;YACD,kCAAkC;iBAC7B,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;gBACnD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,WAAI,CAAC,IAAgB,CAAM,CAAC,CAAC;aAChD;SACD;QAED,uBAAuB;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IACF,mBAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,oCAAY"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ITweet, ITweetEntities } from '
|
|
1
|
+
import { ITweet, ITweetEntities } from '../types/Tweet';
|
|
2
2
|
import { ITweet as IRawTweet, IEntities as IRawTweetEntities } from 'rettiwt-core';
|
|
3
3
|
/**
|
|
4
4
|
* The different types parsed entities like urls, media, mentions, hashtags, etc.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class TweetEntities implements ITweetEntities {
|
|
9
9
|
/** The list of hashtags mentioned in the tweet. */
|
|
@@ -19,7 +19,7 @@ export declare class TweetEntities implements ITweetEntities {
|
|
|
19
19
|
/**
|
|
20
20
|
* The details of a single Tweet.
|
|
21
21
|
*
|
|
22
|
-
* @
|
|
22
|
+
* @public
|
|
23
23
|
*/
|
|
24
24
|
export declare class Tweet implements ITweet {
|
|
25
25
|
/** The rest id of the tweet. */
|
|
@@ -47,7 +47,7 @@ export declare class Tweet implements ITweet {
|
|
|
47
47
|
/** The number of likes of the tweet. */
|
|
48
48
|
likeCount: number;
|
|
49
49
|
/**
|
|
50
|
-
* @param tweet The raw tweet data.
|
|
50
|
+
* @param tweet - The raw tweet data.
|
|
51
51
|
*/
|
|
52
52
|
constructor(tweet: IRawTweet);
|
|
53
53
|
}
|
|
@@ -1,40 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.Tweet = exports.TweetEntities = void 0;
|
|
27
4
|
// PARSERS
|
|
28
|
-
var
|
|
5
|
+
var JsonUtils_1 = require("../helper/JsonUtils");
|
|
29
6
|
/**
|
|
30
7
|
* The different types parsed entities like urls, media, mentions, hashtags, etc.
|
|
31
8
|
*
|
|
32
|
-
* @
|
|
9
|
+
* @public
|
|
33
10
|
*/
|
|
34
11
|
var TweetEntities = /** @class */ (function () {
|
|
35
|
-
// MEMBER METHODS
|
|
36
12
|
function TweetEntities(entities) {
|
|
37
|
-
// MEMBER DATA
|
|
38
13
|
/** The list of hashtags mentioned in the tweet. */
|
|
39
14
|
this.hashtags = [];
|
|
40
15
|
/** The list of urls mentioned in the tweet. */
|
|
@@ -47,7 +22,7 @@ var TweetEntities = /** @class */ (function () {
|
|
|
47
22
|
if (entities.user_mentions) {
|
|
48
23
|
for (var _i = 0, _a = entities.user_mentions; _i < _a.length; _i++) {
|
|
49
24
|
var user = _a[_i];
|
|
50
|
-
this.mentionedUsers.push(user.
|
|
25
|
+
this.mentionedUsers.push(user.screen_name);
|
|
51
26
|
}
|
|
52
27
|
}
|
|
53
28
|
// Extracting urls
|
|
@@ -78,11 +53,11 @@ exports.TweetEntities = TweetEntities;
|
|
|
78
53
|
/**
|
|
79
54
|
* The details of a single Tweet.
|
|
80
55
|
*
|
|
81
|
-
* @
|
|
56
|
+
* @public
|
|
82
57
|
*/
|
|
83
58
|
var Tweet = /** @class */ (function () {
|
|
84
59
|
/**
|
|
85
|
-
* @param tweet The raw tweet data.
|
|
60
|
+
* @param tweet - The raw tweet data.
|
|
86
61
|
*/
|
|
87
62
|
function Tweet(tweet) {
|
|
88
63
|
this.id = tweet.rest_id;
|
|
@@ -90,7 +65,7 @@ var Tweet = /** @class */ (function () {
|
|
|
90
65
|
this.tweetBy = tweet.legacy.user_id_str;
|
|
91
66
|
this.entities = new TweetEntities(tweet.legacy.entities);
|
|
92
67
|
this.quoted = tweet.legacy.quoted_status_id_str;
|
|
93
|
-
this.fullText =
|
|
68
|
+
this.fullText = (0, JsonUtils_1.normalizeText)(tweet.legacy.full_text);
|
|
94
69
|
this.replyTo = tweet.legacy.in_reply_to_status_id_str;
|
|
95
70
|
this.lang = tweet.legacy.lang;
|
|
96
71
|
this.quoteCount = tweet.legacy.quote_count;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../src/models/Tweet.ts"],"names":[],"mappings":";;;AAIA,UAAU;AACV,iDAAoD;AAEpD;;;;GAIG;AACH;IAaC,uBAAY,QAA2B;QAZvC,mDAAmD;QACnD,aAAQ,GAAa,EAAE,CAAC;QAExB,+CAA+C;QAC/C,SAAI,GAAa,EAAE,CAAC;QAEpB,uDAAuD;QACvD,mBAAc,GAAa,EAAE,CAAC;QAE9B,gEAAgE;QAChE,UAAK,GAAa,EAAE,CAAC;QAGpB,2BAA2B;QAC3B,IAAI,QAAQ,CAAC,aAAa,EAAE;YAC3B,KAAmB,UAAsB,EAAtB,KAAA,QAAQ,CAAC,aAAa,EAAtB,cAAsB,EAAtB,IAAsB,EAAE;gBAAtC,IAAM,IAAI,SAAA;gBACd,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;aAC3C;SACD;QAED,kBAAkB;QAClB,IAAI,QAAQ,CAAC,IAAI,EAAE;YAClB,KAAkB,UAAa,EAAb,KAAA,QAAQ,CAAC,IAAI,EAAb,cAAa,EAAb,IAAa,EAAE;gBAA5B,IAAM,GAAG,SAAA;gBACb,IAAI,CAAC,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M,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC;IAC9C,CAAC;IACF,YAAC;AAAD,CAAC,AAtDD,IAsDC;AAtDY,sBAAK"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IUser } from '
|
|
1
|
+
import { IUser } from '../types/User';
|
|
2
2
|
import { IUser as IRawUser } from 'rettiwt-core';
|
|
3
3
|
/**
|
|
4
4
|
* The details of a single user.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class User implements IUser {
|
|
9
9
|
/** The rest id of the user. */
|
|
@@ -35,7 +35,7 @@ export declare class User implements IUser {
|
|
|
35
35
|
/** The url of the profile image. */
|
|
36
36
|
profileImage: string;
|
|
37
37
|
/**
|
|
38
|
-
* @param user The raw user data.
|
|
38
|
+
* @param user - The raw user data.
|
|
39
39
|
*/
|
|
40
40
|
constructor(user: IRawUser);
|
|
41
41
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.User = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The details of a single user.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
var User = /** @class */ (function () {
|
|
10
10
|
/**
|
|
11
|
-
* @param user The raw user data.
|
|
11
|
+
* @param user - The raw user data.
|
|
12
12
|
*/
|
|
13
13
|
function User(user) {
|
|
14
14
|
this.id = user.rest_id;
|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
|
2
|
+
import { AuthCredential } from 'rettiwt-auth';
|
|
3
|
+
import { CursoredData } from '../models/CursoredData';
|
|
4
|
+
import { Tweet } from '../models/Tweet';
|
|
5
|
+
import { User } from '../models/User';
|
|
6
|
+
/**
|
|
7
|
+
* The base service that handles all HTTP requests.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class FetcherService {
|
|
12
|
+
/** The credential to use for authenticating against Twitter API. */
|
|
13
|
+
private cred;
|
|
14
|
+
/**
|
|
15
|
+
* @param cred - The credentials to use for authenticating against Twitter API.
|
|
16
|
+
*/
|
|
17
|
+
constructor(cred: AuthCredential);
|
|
18
|
+
/**
|
|
19
|
+
* The middleware for handling any http error.
|
|
20
|
+
*
|
|
21
|
+
* @param res - The response object received.
|
|
22
|
+
* @returns The received response, if no HTTP errors are found.
|
|
23
|
+
*/
|
|
24
|
+
private handleHttpError;
|
|
25
|
+
/**
|
|
26
|
+
* The middleware for handling any Twitter API-level errors.
|
|
27
|
+
*
|
|
28
|
+
* @param res - The response object received.
|
|
29
|
+
* @returns The received response, if no API errors are found.
|
|
30
|
+
*/
|
|
31
|
+
private handleApiError;
|
|
32
|
+
/**
|
|
33
|
+
* Makes an HTTP request according to the given parameters.
|
|
34
|
+
*
|
|
35
|
+
* @param config - The request configuration.
|
|
36
|
+
* @returns The response received.
|
|
37
|
+
*/
|
|
38
|
+
private request;
|
|
39
|
+
/**
|
|
40
|
+
* Extracts the required data based on the type of resource passed as argument.
|
|
41
|
+
*
|
|
42
|
+
* @param data - The data from which extraction is to be done.
|
|
43
|
+
* @param type - The type of data to extract.
|
|
44
|
+
* @typeParam BaseType - The base type of the raw data present in the input.
|
|
45
|
+
* @typeParam DeserializedType - The type of data produced after deserialization of BaseType.
|
|
46
|
+
* @returns The extracted data.
|
|
47
|
+
*/
|
|
48
|
+
private extractData;
|
|
49
|
+
/**
|
|
50
|
+
* Fetches the requested resource from Twitter and returns it after processing.
|
|
51
|
+
*
|
|
52
|
+
* @param resourceType - The type of resource to fetch.
|
|
53
|
+
* @param args - Resource specific arguments.
|
|
54
|
+
* @typeParam OutType - The type of deserialized data returned.
|
|
55
|
+
* @returns The processed data requested from Twitter.
|
|
56
|
+
*/
|
|
57
|
+
protected fetch<OutType extends Tweet | User>(resourceType: EResourceType, args: Args): Promise<CursoredData<OutType>>;
|
|
58
|
+
/**
|
|
59
|
+
* Posts the requested resource to Twitter and returns the response.
|
|
60
|
+
*
|
|
61
|
+
* @param resourceType - The type of resource to post.
|
|
62
|
+
* @param args - Resource specific arguments.
|
|
63
|
+
* @returns Whether posting was successful or not.
|
|
64
|
+
*/
|
|
65
|
+
protected post(resourceType: EResourceType, args: Args): Promise<boolean>;
|
|
66
|
+
}
|