rettiwt-api 1.3.1 → 2.0.0
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 +47 -0
- package/.github/workflows/{publish-to-npm.yml → publish.yml} +8 -8
- 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 +207 -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 +183 -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/.github/workflows/build-docs.yml +0 -28
- 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 -78
- 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 -312
- 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 -251
- 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 -223
- 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 -75
- package/src/graphql/resolvers/AccountResolver.ts +0 -22
- package/src/graphql/resolvers/ResolverBase.ts +0 -26
- package/src/graphql/resolvers/TweetResolver.ts +0 -237
- 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 -135
- 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 -198
- 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
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
-
function step(op) {
|
|
54
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
-
while (_) try {
|
|
56
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
-
switch (op[0]) {
|
|
59
|
-
case 0: case 1: t = op; break;
|
|
60
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
-
default:
|
|
64
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
-
if (t[2]) _.ops.pop();
|
|
69
|
-
_.trys.pop(); continue;
|
|
70
|
-
}
|
|
71
|
-
op = body.call(thisArg, _);
|
|
72
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
exports.__esModule = true;
|
|
77
|
-
exports.TweetService = void 0;
|
|
78
|
-
// PACKAGES
|
|
79
|
-
var rettiwt_core_1 = require("rettiwt-core");
|
|
80
|
-
// SERVICES
|
|
81
|
-
var FetcherService_1 = require("../util/FetcherService");
|
|
82
|
-
// MODELS
|
|
83
|
-
var Tweet_1 = require("../../models/data/Tweet");
|
|
84
|
-
var User_1 = require("../../models/data/User");
|
|
85
|
-
var TweetListArgs_1 = require("../../models/args/TweetListArgs");
|
|
86
|
-
var CursoredData_1 = require("../../models/data/CursoredData");
|
|
87
|
-
// ENUMS
|
|
88
|
-
var Errors_1 = require("../../enums/Errors");
|
|
89
|
-
// EXTRACTORS
|
|
90
|
-
var TweetExtractors = __importStar(require("../helper/extractors/Tweets"));
|
|
91
|
-
/**
|
|
92
|
-
* Handles fetching of data related to tweets.
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
var TweetService = /** @class */ (function (_super) {
|
|
96
|
-
__extends(TweetService, _super);
|
|
97
|
-
/**
|
|
98
|
-
* @param auth The AuthService instance to use for authentication.
|
|
99
|
-
*/
|
|
100
|
-
function TweetService(auth) {
|
|
101
|
-
return _super.call(this, auth) || this;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* @param filter The filter be used for searching the tweets.
|
|
105
|
-
* @param count The number of tweets to fetch, must be >= 10 (when no cursor is provided) and <= 20
|
|
106
|
-
* @param cursor The cursor to the next batch of tweets. If blank, first batch is fetched.
|
|
107
|
-
*
|
|
108
|
-
* @returns The list of tweets that match the given filter.
|
|
109
|
-
*
|
|
110
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
111
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if an invalid count has been provided.
|
|
112
|
-
*/
|
|
113
|
-
TweetService.prototype.getTweets = function (query, count, cursor) {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
-
var filter, args, url, res, data, tweets;
|
|
116
|
-
return __generator(this, function (_a) {
|
|
117
|
-
switch (_a.label) {
|
|
118
|
-
case 0:
|
|
119
|
-
// If user is not authenticated, abort
|
|
120
|
-
if (!this.isAuthenticated) {
|
|
121
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
122
|
-
}
|
|
123
|
-
filter = new rettiwt_core_1.TweetFilter(query);
|
|
124
|
-
args = new TweetListArgs_1.TweetListArgs(count, cursor);
|
|
125
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.TWEET_SEARCH, { filter: filter.toString(), count: args.count, cursor: args.cursor }).toString();
|
|
126
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
127
|
-
case 1:
|
|
128
|
-
res = _a.sent();
|
|
129
|
-
data = TweetExtractors.extractTweets(res);
|
|
130
|
-
// Caching data
|
|
131
|
-
this.cacheData(data);
|
|
132
|
-
tweets = data.required.map(function (item) { return new Tweet_1.Tweet(item); });
|
|
133
|
-
// Sorting the tweets by date, from recent to oldest
|
|
134
|
-
tweets.sort(function (a, b) { return new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf(); });
|
|
135
|
-
return [2 /*return*/, new CursoredData_1.CursoredData(tweets, data.cursor)];
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* @param id The id of the target tweet.
|
|
142
|
-
*
|
|
143
|
-
* @returns The details of a single tweet with the given tweet id.
|
|
144
|
-
*
|
|
145
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
146
|
-
* @throws {@link Errors.DataErrors.TweetNotFound} error, if no tweet with the given id was found.
|
|
147
|
-
*/
|
|
148
|
-
TweetService.prototype.getTweetDetails = function (id) {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var cachedData, url, res, data, tweet;
|
|
151
|
-
return __generator(this, function (_a) {
|
|
152
|
-
switch (_a.label) {
|
|
153
|
-
case 0:
|
|
154
|
-
// If user is not authenticated, abort
|
|
155
|
-
if (!this.isAuthenticated) {
|
|
156
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
157
|
-
}
|
|
158
|
-
return [4 /*yield*/, this.readData(id)];
|
|
159
|
-
case 1:
|
|
160
|
-
cachedData = _a.sent();
|
|
161
|
-
// If data exists in cache
|
|
162
|
-
if (cachedData) {
|
|
163
|
-
return [2 /*return*/, cachedData];
|
|
164
|
-
}
|
|
165
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.TWEET_DETAILS, { id: id }).toString();
|
|
166
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
167
|
-
case 2:
|
|
168
|
-
res = _a.sent();
|
|
169
|
-
data = TweetExtractors.extractTweet(res, id);
|
|
170
|
-
// Caching data
|
|
171
|
-
this.cacheData(data);
|
|
172
|
-
tweet = new Tweet_1.Tweet(data.required[0]);
|
|
173
|
-
return [2 /*return*/, tweet];
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* @param tweetId The rest id of the target tweet.
|
|
180
|
-
* @param count The batch size of the list, must be >= 10 (when no cursor is provided) and <= 20.
|
|
181
|
-
* @param cursor The cursor to the next batch of users. If blank, first batch is fetched.
|
|
182
|
-
*
|
|
183
|
-
* @returns The list of users who liked the given tweet.
|
|
184
|
-
*
|
|
185
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
186
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count is provided.
|
|
187
|
-
* @throws {@link Errors.DataErrors.TweetNotFound} error, if no tweet with the given id was found.
|
|
188
|
-
*/
|
|
189
|
-
TweetService.prototype.getTweetLikers = function (tweetId, count, cursor) {
|
|
190
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
-
var args, url, res, data, users;
|
|
192
|
-
return __generator(this, function (_a) {
|
|
193
|
-
switch (_a.label) {
|
|
194
|
-
case 0:
|
|
195
|
-
// If user is not authenticated, abort
|
|
196
|
-
if (!this.isAuthenticated) {
|
|
197
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
198
|
-
}
|
|
199
|
-
args = new TweetListArgs_1.TweetListArgs(count, cursor);
|
|
200
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.TWEET_FAVORITERS, { id: tweetId, count: args.count, cursor: args.cursor }).toString();
|
|
201
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
202
|
-
case 1:
|
|
203
|
-
res = _a.sent();
|
|
204
|
-
data = TweetExtractors.extractTweetLikers(res);
|
|
205
|
-
// Caching data
|
|
206
|
-
this.cacheData(data);
|
|
207
|
-
users = data.required.map(function (item) { return new User_1.User(item); });
|
|
208
|
-
return [2 /*return*/, new CursoredData_1.CursoredData(users, data.cursor)];
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
|
-
* @param tweetId The rest id of the target tweet.
|
|
215
|
-
* @param count The batch size of the list, must be >= 10 (when no cursor is provided) and <= 100.
|
|
216
|
-
* @param cursor The cursor to the next batch of users. If blank, first batch is fetched.
|
|
217
|
-
*
|
|
218
|
-
* @returns The list of users who retweeted the given tweet.
|
|
219
|
-
*
|
|
220
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
221
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count is provided.
|
|
222
|
-
* @throws {@link Errors.DataErrors.TweetNotFound} error, if no tweet with the given id was found.
|
|
223
|
-
*/
|
|
224
|
-
TweetService.prototype.getTweetRetweeters = function (tweetId, count, cursor) {
|
|
225
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
226
|
-
var args, url, res, data, users;
|
|
227
|
-
return __generator(this, function (_a) {
|
|
228
|
-
switch (_a.label) {
|
|
229
|
-
case 0:
|
|
230
|
-
// If user is not authenticated, abort
|
|
231
|
-
if (!this.isAuthenticated) {
|
|
232
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
233
|
-
}
|
|
234
|
-
args = new TweetListArgs_1.TweetListArgs(count, cursor);
|
|
235
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.TWEET_RETWEETERS, { id: tweetId, count: args.count, cursor: args.cursor }).toString();
|
|
236
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
237
|
-
case 1:
|
|
238
|
-
res = _a.sent();
|
|
239
|
-
data = TweetExtractors.extractTweetRetweeters(res);
|
|
240
|
-
// Caching data
|
|
241
|
-
this.cacheData(data);
|
|
242
|
-
users = data.required.map(function (item) { return new User_1.User(item); });
|
|
243
|
-
return [2 /*return*/, new CursoredData_1.CursoredData(users, data.cursor)];
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
};
|
|
248
|
-
return TweetService;
|
|
249
|
-
}(FetcherService_1.FetcherService));
|
|
250
|
-
exports.TweetService = TweetService;
|
|
251
|
-
//# sourceMappingURL=TweetService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TweetService.js","sourceRoot":"","sources":["../../../src/services/data/TweetService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAUsB;AAEtB,WAAW;AACX,yDAAwD;AAGxD,SAAS;AACT,iDAAgD;AAChD,+CAA8C;AAC9C,iEAAgE;AAChE,+DAA8D;AAE9D,QAAQ;AACR,6CAA0D;AAE1D,aAAa;AACb,2EAA+D;AAE/D;;;GAGG;AACH;IAAkC,gCAAc;IAC5C;;OAEG;IACH,sBAAY,IAAiB;eACzB,kBAAM,IAAI,CAAC;IACf,CAAC;IAED;;;;;;;;;OASG;IACG,gCAAS,GAAf,UAAgB,KAAkB,EAAE,KAAc,EAAE,MAAe;;;;;;wBAC/D,sCAAsC;wBACtC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;4BACvB,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,gBAAgB,CAAC,CAAC;yBAC1D;wB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BAAsB,CAAC,GAAG,CAAC,CAAC;wBAEvD,eAAe;wBACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;wBAGjB,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAC,IAAc,IAAK,OAAA,IAAI,WAAI,CAAC,IAAI,CAAC,EAAd,CAAc,CAAC,CAAC;wBAElE,sBAAO,IAAI,2BAAY,CAAO,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC;;;;KACrD;IACL,mBAAC;AAAD,CAAC,AApKD,CAAkC,+BAAc,GAoK/C;AApKY,oCAAY"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { FetcherService } from '../util/FetcherService';
|
|
2
|
-
import { AuthService } from '../auth/AuthService';
|
|
3
|
-
import { User } from '../../models/data/User';
|
|
4
|
-
import { Tweet } from '../../models/data/Tweet';
|
|
5
|
-
import { CursoredData } from '../../models/data/CursoredData';
|
|
6
|
-
/**
|
|
7
|
-
* Handles fetching of data related to user account
|
|
8
|
-
*/
|
|
9
|
-
export declare class UserService extends FetcherService {
|
|
10
|
-
/**
|
|
11
|
-
* @param auth The AuthService instance to use for authentication.
|
|
12
|
-
*/
|
|
13
|
-
constructor(auth: AuthService);
|
|
14
|
-
/**
|
|
15
|
-
* @param id The id/username of the target user.
|
|
16
|
-
*
|
|
17
|
-
* @returns The details of the given user.
|
|
18
|
-
*
|
|
19
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
20
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if no user with the given username was found.
|
|
21
|
-
*/
|
|
22
|
-
getUserDetails(id: string): Promise<User>;
|
|
23
|
-
/**
|
|
24
|
-
* @param userId The rest id of the target user.
|
|
25
|
-
* @param count The number of tweets to fetch, must be >= 40 (when no cursor is provided) and <=100.
|
|
26
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched.
|
|
27
|
-
*
|
|
28
|
-
* @returns The list of tweets nade by the target user.
|
|
29
|
-
*
|
|
30
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
31
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count has been provided.
|
|
32
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if invalid count has been provided.
|
|
33
|
-
*
|
|
34
|
-
* @deprecated Use [this](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#getTweets) method instead. It's better in every possible way!
|
|
35
|
-
*/
|
|
36
|
-
getUserTweets(userId: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
|
|
37
|
-
/**
|
|
38
|
-
* @param userId The rest id of the target user.
|
|
39
|
-
* @param count The number of following to fetch, must be >= 40 (when no cursor is provided) and <=100.
|
|
40
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched.
|
|
41
|
-
*
|
|
42
|
-
* @returns The list of users followed by the target user.
|
|
43
|
-
*
|
|
44
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
45
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count has been provided.
|
|
46
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if invalid count has been provided.
|
|
47
|
-
*/
|
|
48
|
-
getUserFollowing(userId: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
|
|
49
|
-
/**
|
|
50
|
-
* @param userId The rest id of the target user.
|
|
51
|
-
* @param count The number of followers to fetch, must be >= 40 (when no cursor is provided) and <=100.
|
|
52
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched.
|
|
53
|
-
*
|
|
54
|
-
* @returns The list of users following the target user.
|
|
55
|
-
*
|
|
56
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
57
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count has been provided.
|
|
58
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if invalid count has been provided.
|
|
59
|
-
*/
|
|
60
|
-
getUserFollowers(userId: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
|
|
61
|
-
/**
|
|
62
|
-
* @param userId The rest id of the target user.
|
|
63
|
-
* @param count The number of likes to fetch.
|
|
64
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched, must be >= 40 (when no cursor is provided) and <=100.
|
|
65
|
-
*
|
|
66
|
-
* @returns The list of tweets liked by the target user.
|
|
67
|
-
*
|
|
68
|
-
* @throws {@link AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
69
|
-
*/
|
|
70
|
-
getUserLikes(userId: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
|
|
71
|
-
}
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
-
function step(op) {
|
|
54
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
-
while (_) try {
|
|
56
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
-
switch (op[0]) {
|
|
59
|
-
case 0: case 1: t = op; break;
|
|
60
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
-
default:
|
|
64
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
-
if (t[2]) _.ops.pop();
|
|
69
|
-
_.trys.pop(); continue;
|
|
70
|
-
}
|
|
71
|
-
op = body.call(thisArg, _);
|
|
72
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
exports.__esModule = true;
|
|
77
|
-
exports.UserService = void 0;
|
|
78
|
-
// PACKAGES
|
|
79
|
-
var rettiwt_core_1 = require("rettiwt-core");
|
|
80
|
-
// SERVICES
|
|
81
|
-
var FetcherService_1 = require("../util/FetcherService");
|
|
82
|
-
// MODELS
|
|
83
|
-
var User_1 = require("../../models/data/User");
|
|
84
|
-
var UserListArgs_1 = require("../../models/args/UserListArgs");
|
|
85
|
-
var Tweet_1 = require("../../models/data/Tweet");
|
|
86
|
-
// TYPES
|
|
87
|
-
var CursoredData_1 = require("../../models/data/CursoredData");
|
|
88
|
-
// ENUMS
|
|
89
|
-
var Errors_1 = require("../../enums/Errors");
|
|
90
|
-
// EXTRACTORS
|
|
91
|
-
var UserExtractors = __importStar(require("../helper/extractors/Users"));
|
|
92
|
-
var TweetService_1 = require("./TweetService");
|
|
93
|
-
/**
|
|
94
|
-
* Handles fetching of data related to user account
|
|
95
|
-
*/
|
|
96
|
-
var UserService = /** @class */ (function (_super) {
|
|
97
|
-
__extends(UserService, _super);
|
|
98
|
-
/**
|
|
99
|
-
* @param auth The AuthService instance to use for authentication.
|
|
100
|
-
*/
|
|
101
|
-
function UserService(auth) {
|
|
102
|
-
return _super.call(this, auth) || this;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @param id The id/username of the target user.
|
|
106
|
-
*
|
|
107
|
-
* @returns The details of the given user.
|
|
108
|
-
*
|
|
109
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
110
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if no user with the given username was found.
|
|
111
|
-
*/
|
|
112
|
-
UserService.prototype.getUserDetails = function (id) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var res, cachedData, url, data, user;
|
|
115
|
-
return __generator(this, function (_a) {
|
|
116
|
-
switch (_a.label) {
|
|
117
|
-
case 0:
|
|
118
|
-
// If user is not authenticated, abort
|
|
119
|
-
if (!this.isAuthenticated) {
|
|
120
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
121
|
-
}
|
|
122
|
-
return [4 /*yield*/, this.readData(id)];
|
|
123
|
-
case 1:
|
|
124
|
-
cachedData = _a.sent();
|
|
125
|
-
if (!cachedData) return [3 /*break*/, 2];
|
|
126
|
-
return [2 /*return*/, cachedData];
|
|
127
|
-
case 2:
|
|
128
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.USER_DETAILS, { id: id }).toString();
|
|
129
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
130
|
-
case 3:
|
|
131
|
-
// Fetching the raw data
|
|
132
|
-
res = _a.sent();
|
|
133
|
-
data = UserExtractors.extractUserDetails(res);
|
|
134
|
-
// Caching data
|
|
135
|
-
this.cacheData(data);
|
|
136
|
-
user = new User_1.User(data.required[0]);
|
|
137
|
-
return [2 /*return*/, user];
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* @param userId The rest id of the target user.
|
|
144
|
-
* @param count The number of tweets to fetch, must be >= 40 (when no cursor is provided) and <=100.
|
|
145
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched.
|
|
146
|
-
*
|
|
147
|
-
* @returns The list of tweets nade by the target user.
|
|
148
|
-
*
|
|
149
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
150
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count has been provided.
|
|
151
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if invalid count has been provided.
|
|
152
|
-
*
|
|
153
|
-
* @deprecated Use [this](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#getTweets) method instead. It's better in every possible way!
|
|
154
|
-
*/
|
|
155
|
-
UserService.prototype.getUserTweets = function (userId, count, cursor) {
|
|
156
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
157
|
-
var userName;
|
|
158
|
-
return __generator(this, function (_a) {
|
|
159
|
-
switch (_a.label) {
|
|
160
|
-
case 0: return [4 /*yield*/, this.getUserDetails(userId)];
|
|
161
|
-
case 1:
|
|
162
|
-
userName = (_a.sent()).userName;
|
|
163
|
-
// Getting the tweets of the target user
|
|
164
|
-
return [2 /*return*/, new TweetService_1.TweetService(this.auth).getTweets({
|
|
165
|
-
fromUsers: [userName]
|
|
166
|
-
}, count, cursor)];
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* @param userId The rest id of the target user.
|
|
173
|
-
* @param count The number of following to fetch, must be >= 40 (when no cursor is provided) and <=100.
|
|
174
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched.
|
|
175
|
-
*
|
|
176
|
-
* @returns The list of users followed by the target user.
|
|
177
|
-
*
|
|
178
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
179
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count has been provided.
|
|
180
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if invalid count has been provided.
|
|
181
|
-
*/
|
|
182
|
-
UserService.prototype.getUserFollowing = function (userId, count, cursor) {
|
|
183
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
-
var args, url, res, data, users;
|
|
185
|
-
return __generator(this, function (_a) {
|
|
186
|
-
switch (_a.label) {
|
|
187
|
-
case 0:
|
|
188
|
-
// If user is not authenticated, abort
|
|
189
|
-
if (!this.isAuthenticated) {
|
|
190
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
191
|
-
}
|
|
192
|
-
args = new UserListArgs_1.UserListArgs(count, cursor);
|
|
193
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.USER_FOLLOWING, { id: userId, count: args.count, cursor: args.cursor }).toString();
|
|
194
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
195
|
-
case 1:
|
|
196
|
-
res = _a.sent();
|
|
197
|
-
data = UserExtractors.extractUserFollow(res);
|
|
198
|
-
// Caching data
|
|
199
|
-
this.cacheData(data);
|
|
200
|
-
users = data.required.map(function (item) { return new User_1.User(item); });
|
|
201
|
-
return [2 /*return*/, new CursoredData_1.CursoredData(users, data.cursor)];
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* @param userId The rest id of the target user.
|
|
208
|
-
* @param count The number of followers to fetch, must be >= 40 (when no cursor is provided) and <=100.
|
|
209
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched.
|
|
210
|
-
*
|
|
211
|
-
* @returns The list of users following the target user.
|
|
212
|
-
*
|
|
213
|
-
* @throws {@link Errors.AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
214
|
-
* @throws {@link Errors.ValidationErrors.InvalidCount} error, if invalid count has been provided.
|
|
215
|
-
* @throws {@link Errors.DataErrors.UserNotFound} error, if invalid count has been provided.
|
|
216
|
-
*/
|
|
217
|
-
UserService.prototype.getUserFollowers = function (userId, count, cursor) {
|
|
218
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
-
var args, url, res, data, users;
|
|
220
|
-
return __generator(this, function (_a) {
|
|
221
|
-
switch (_a.label) {
|
|
222
|
-
case 0:
|
|
223
|
-
// If user is not authenticated, abort
|
|
224
|
-
if (!this.isAuthenticated) {
|
|
225
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
226
|
-
}
|
|
227
|
-
args = new UserListArgs_1.UserListArgs(count, cursor);
|
|
228
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.USER_FOLLOWERS, { id: userId, count: args.count, cursor: args.cursor }).toString();
|
|
229
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
230
|
-
case 1:
|
|
231
|
-
res = _a.sent();
|
|
232
|
-
data = UserExtractors.extractUserFollow(res);
|
|
233
|
-
// Caching data
|
|
234
|
-
this.cacheData(data);
|
|
235
|
-
users = data.required.map(function (item) { return new User_1.User(item); });
|
|
236
|
-
return [2 /*return*/, new CursoredData_1.CursoredData(users, data.cursor)];
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
/**
|
|
242
|
-
* @param userId The rest id of the target user.
|
|
243
|
-
* @param count The number of likes to fetch.
|
|
244
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched, must be >= 40 (when no cursor is provided) and <=100.
|
|
245
|
-
*
|
|
246
|
-
* @returns The list of tweets liked by the target user.
|
|
247
|
-
*
|
|
248
|
-
* @throws {@link AuthenticationErrors.NotAuthenticated} error, if no cookies have been provided.
|
|
249
|
-
*/
|
|
250
|
-
UserService.prototype.getUserLikes = function (userId, count, cursor) {
|
|
251
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
252
|
-
var args, url, res, data, tweets;
|
|
253
|
-
return __generator(this, function (_a) {
|
|
254
|
-
switch (_a.label) {
|
|
255
|
-
case 0:
|
|
256
|
-
// If user is not authenticated, abort
|
|
257
|
-
if (!this.isAuthenticated) {
|
|
258
|
-
throw new Error(Errors_1.AuthenticationErrors.NotAuthenticated);
|
|
259
|
-
}
|
|
260
|
-
args = new UserListArgs_1.UserListArgs(count, cursor);
|
|
261
|
-
url = new rettiwt_core_1.Url(rettiwt_core_1.EResourceType.USER_LIKES, { id: userId, count: args.count, cursor: args.cursor }).toString();
|
|
262
|
-
return [4 /*yield*/, this.request(url).then(function (res) { return res.data; })];
|
|
263
|
-
case 1:
|
|
264
|
-
res = _a.sent();
|
|
265
|
-
data = UserExtractors.extractUserLikes(res);
|
|
266
|
-
// Caching data
|
|
267
|
-
this.cacheData(data);
|
|
268
|
-
tweets = data.required.map(function (item) { return new Tweet_1.Tweet(item); });
|
|
269
|
-
return [2 /*return*/, new CursoredData_1.CursoredData(tweets, data.cursor)];
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
};
|
|
274
|
-
return UserService;
|
|
275
|
-
}(FetcherService_1.FetcherService));
|
|
276
|
-
exports.UserService = UserService;
|
|
277
|
-
;
|
|
278
|
-
//# sourceMappingURL=UserService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src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,EAAC;;;;KACrD;IAED;;;;;;;;OAQG;IACG,kCAAY,GAAlB,UAAmB,MAAc,EAAE,KAAc,EAAE,MAAe;;;;;;wBAC9D,sCAAsC;wBACtC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;4BACvB,MAAM,IAAI,KAAK,CAAC,6BAAoB,CAAC,gBAAgB,CAAC,CAAC;yBAC1D;wBAGG,IAAI,GAAiB,IAAI,2BAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;wBAGnD,GAAG,GAAW,IAAI,kBAAG,CAAC,4BAAa,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;wBAG/G,qBAAM,IAAI,CAAC,OAAO,CAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAR,CAAQ,CAAC,EAAA;;wBAAvE,GAAG,GAAG,SAAiE;wBAGvE,IAAI,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;wBAEhD,eAAe;wBACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;wBAGjB,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAC,IAAe,IAAK,OAAA,IAAI,aAAK,CAAC,IAAI,CAAC,EAAf,CAAe,CAAC,CAAC;wBAErE,sBAAO,IAAI,2BAAY,CAAQ,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC;;;;KACvD;IACL,kBAAC;AAAD,CAAC,AA1LD,CAAiC,+BAAc,GA0L9C;AA1LY,kCAAW;AA0LvB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IGuestCredentials, IAuthCredentials } from '../../types/Authentication';
|
|
2
|
-
/**
|
|
3
|
-
* @param authToken The authentication token received from Twitter
|
|
4
|
-
* @param csrfToken The csrf token received from Twitter
|
|
5
|
-
* @param cookie The cookie associated with the logged in account
|
|
6
|
-
* @returns The header required for making authorized HTTP requests
|
|
7
|
-
*/
|
|
8
|
-
export declare function authorizedHeader(authCred: IAuthCredentials): any;
|
|
9
|
-
/**
|
|
10
|
-
* @param guestCred The guest credentials to use
|
|
11
|
-
* @returns The header requred for making guest HTTP requests
|
|
12
|
-
*/
|
|
13
|
-
export declare function guestHeader(guestCred: IGuestCredentials): any;
|
|
14
|
-
/**
|
|
15
|
-
* @param guestCred The guest credentials to use for making the login requests
|
|
16
|
-
* @param cookie The cookie to be used
|
|
17
|
-
* @returns The header for making HTTP request for logging in
|
|
18
|
-
*/
|
|
19
|
-
export declare function loginHeader(guestCred: IGuestCredentials, cookie: string): any;
|