rettiwt-api 5.0.0-alpha.0 → 5.0.0-alpha.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/.eslintrc.js +2 -3
- package/.github/workflows/documentation.yml +1 -1
- package/.github/workflows/publish-alpha.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/.prettierignore +1 -1
- package/.tool-versions +1 -1
- package/README.md +100 -100
- package/dist/Rettiwt.d.ts +1 -1
- package/dist/Rettiwt.js +15 -8
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +8 -11
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +1 -0
- package/dist/collections/Extractors.js +38 -69
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.js +2 -1
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.d.ts +3 -3
- package/dist/collections/Requests.js +36 -35
- package/dist/collections/Requests.js.map +1 -1
- package/dist/commands/List.js +21 -78
- package/dist/commands/List.js.map +1 -1
- package/dist/commands/Tweet.js +185 -370
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +129 -306
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Authentication.d.ts +18 -0
- package/dist/enums/Authentication.js +24 -0
- package/dist/enums/Authentication.js.map +1 -0
- package/dist/enums/Data.d.ts +12 -0
- package/dist/enums/Data.js +14 -1
- package/dist/enums/Data.js.map +1 -1
- package/dist/enums/Resource.d.ts +1 -0
- package/dist/enums/Resource.js +1 -0
- package/dist/enums/Resource.js.map +1 -1
- package/dist/helper/CliUtils.js +1 -2
- package/dist/helper/CliUtils.js.map +1 -1
- package/dist/helper/JsonUtils.js +6 -11
- package/dist/helper/JsonUtils.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +4 -133
- package/dist/models/args/FetchArgs.js +12 -416
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/args/PostArgs.d.ts +16 -101
- package/dist/models/args/PostArgs.js +26 -258
- package/dist/models/args/PostArgs.js.map +1 -1
- package/dist/models/auth/AccountCredential.d.ts +13 -0
- package/dist/models/auth/AccountCredential.js +21 -0
- package/dist/models/auth/AccountCredential.js.map +1 -0
- package/dist/models/auth/AuthCookie.d.ts +19 -0
- package/dist/models/auth/AuthCookie.js +53 -0
- package/dist/models/auth/AuthCookie.js.map +1 -0
- package/dist/models/auth/AuthCredential.d.ts +28 -0
- package/dist/models/auth/AuthCredential.js +76 -0
- package/dist/models/auth/AuthCredential.js.map +1 -0
- package/dist/models/data/CursoredData.d.ts +3 -4
- package/dist/models/data/CursoredData.js +19 -19
- package/dist/models/data/CursoredData.js.map +1 -1
- package/dist/models/data/List.d.ts +2 -8
- package/dist/models/data/List.js +10 -4
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Notification.d.ts +5 -21
- package/dist/models/data/Notification.js +24 -33
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +6 -23
- package/dist/models/data/Tweet.js +93 -97
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +2 -15
- package/dist/models/data/User.js +33 -23
- package/dist/models/data/User.js.map +1 -1
- package/dist/models/errors/ApiError.js +8 -24
- package/dist/models/errors/ApiError.js.map +1 -1
- package/dist/models/errors/HttpError.js +8 -24
- package/dist/models/errors/HttpError.js.map +1 -1
- package/dist/models/errors/RettiwtError.js +5 -23
- package/dist/models/errors/RettiwtError.js.map +1 -1
- package/dist/models/errors/TimeoutError.js +5 -22
- package/dist/models/errors/TimeoutError.js.map +1 -1
- package/dist/services/{public → internal}/AuthService.d.ts +5 -34
- package/dist/services/internal/AuthService.js +109 -0
- package/dist/services/internal/AuthService.js.map +1 -0
- package/dist/services/internal/ErrorService.js +38 -40
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/LogService.d.ts +0 -6
- package/dist/services/internal/LogService.js +12 -32
- package/dist/services/internal/LogService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +5 -3
- package/dist/services/public/FetcherService.js +96 -141
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.js +31 -100
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +29 -4
- package/dist/services/public/TweetService.js +208 -386
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.js +186 -385
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/RettiwtConfig.d.ts +8 -0
- package/dist/types/args/FetchArgs.d.ts +59 -0
- package/dist/types/args/FetchArgs.js +3 -0
- package/dist/types/args/FetchArgs.js.map +1 -0
- package/dist/types/args/PostArgs.d.ts +56 -0
- package/dist/types/args/PostArgs.js +3 -0
- package/dist/types/args/PostArgs.js.map +1 -0
- package/dist/types/auth/AccountCredential.d.ts +11 -0
- package/dist/types/auth/AccountCredential.js +3 -0
- package/dist/types/auth/AccountCredential.js.map +1 -0
- package/dist/types/auth/AuthCookie.d.ts +13 -0
- package/dist/types/auth/AuthCookie.js +3 -0
- package/dist/types/auth/AuthCookie.js.map +1 -0
- package/dist/types/auth/AuthCredential.d.ts +21 -0
- package/dist/types/auth/AuthCredential.js +3 -0
- package/dist/types/auth/AuthCredential.js.map +1 -0
- package/dist/types/data/CursoredData.d.ts +25 -0
- package/dist/types/data/CursoredData.js +3 -0
- package/dist/types/data/CursoredData.js.map +1 -0
- package/dist/types/data/List.d.ts +21 -0
- package/dist/types/data/List.js +3 -0
- package/dist/types/data/List.js.map +1 -0
- package/dist/types/data/Notification.d.ts +20 -0
- package/dist/types/data/Notification.js +3 -0
- package/dist/types/data/Notification.js.map +1 -0
- package/dist/types/data/Tweet.d.ts +71 -0
- package/dist/types/data/Tweet.js +3 -0
- package/dist/types/data/Tweet.js.map +1 -0
- package/dist/types/data/User.d.ts +35 -0
- package/dist/types/data/User.js +3 -0
- package/dist/types/data/User.js.map +1 -0
- package/eslint.config.mjs +17 -0
- package/package.json +22 -19
- package/src/Rettiwt.ts +1 -1
- package/src/cli.ts +0 -2
- package/src/collections/Extractors.ts +2 -0
- package/src/collections/Groups.ts +1 -0
- package/src/collections/Requests.ts +37 -36
- package/src/enums/Authentication.ts +19 -0
- package/src/enums/Data.ts +13 -0
- package/src/enums/Resource.ts +1 -0
- package/src/helper/JsonUtils.ts +1 -1
- package/src/index.ts +1 -2
- package/src/models/args/FetchArgs.ts +4 -470
- package/src/models/args/PostArgs.ts +20 -285
- package/src/models/auth/AccountCredential.ts +19 -0
- package/src/models/auth/AuthCookie.ts +56 -0
- package/src/models/auth/AuthCredential.ts +83 -0
- package/src/models/data/CursoredData.ts +12 -9
- package/src/models/data/List.ts +3 -14
- package/src/models/data/Notification.ts +6 -28
- package/src/models/data/Tweet.ts +28 -70
- package/src/models/data/User.ts +5 -31
- package/src/services/{public → internal}/AuthService.ts +28 -55
- package/src/services/internal/LogService.ts +4 -19
- package/src/services/public/FetcherService.ts +18 -8
- package/src/services/public/TweetService.ts +44 -4
- package/src/services/public/UserService.ts +2 -2
- package/src/types/RettiwtConfig.ts +7 -0
- package/src/types/args/FetchArgs.ts +64 -0
- package/src/types/args/PostArgs.ts +62 -0
- package/src/types/auth/AccountCredential.ts +13 -0
- package/src/types/auth/AuthCookie.ts +20 -0
- package/src/types/auth/AuthCredential.ts +26 -0
- package/src/types/data/CursoredData.ts +28 -0
- package/src/types/data/List.ts +27 -0
- package/src/types/data/Notification.ts +26 -0
- package/src/types/data/Tweet.ts +96 -0
- package/src/types/data/User.ts +48 -0
- package/tsconfig.json +7 -5
- package/.eslintignore +0 -3
- package/dist/commands/Auth.d.ts +0 -10
- package/dist/commands/Auth.js +0 -101
- package/dist/commands/Auth.js.map +0 -1
- package/dist/models/errors/DataValidationError.d.ts +0 -30
- package/dist/models/errors/DataValidationError.js +0 -34
- package/dist/models/errors/DataValidationError.js.map +0 -1
- package/dist/services/public/AuthService.js +0 -205
- package/dist/services/public/AuthService.js.map +0 -1
- package/src/commands/Auth.ts +0 -46
- package/src/models/errors/DataValidationError.ts +0 -44
|
@@ -1,88 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
4
|
};
|
|
52
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
6
|
exports.FetcherService = void 0;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
7
|
+
const https_1 = __importDefault(require("https"));
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const cookiejar_1 = require("cookiejar");
|
|
10
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
11
|
+
const Groups_1 = require("../../collections/Groups");
|
|
12
|
+
const Requests_1 = require("../../collections/Requests");
|
|
13
|
+
const Api_1 = require("../../enums/Api");
|
|
14
|
+
const Logging_1 = require("../../enums/Logging");
|
|
15
|
+
const FetchArgs_1 = require("../../models/args/FetchArgs");
|
|
16
|
+
const PostArgs_1 = require("../../models/args/PostArgs");
|
|
17
|
+
const AuthCredential_1 = require("../../models/auth/AuthCredential");
|
|
18
|
+
const AuthService_1 = require("../internal/AuthService");
|
|
19
|
+
const ErrorService_1 = require("../internal/ErrorService");
|
|
20
|
+
const LogService_1 = require("../internal/LogService");
|
|
67
21
|
/**
|
|
68
22
|
* The base service that handles all HTTP requests.
|
|
69
23
|
*
|
|
70
24
|
* @public
|
|
71
25
|
*/
|
|
72
|
-
|
|
26
|
+
class FetcherService {
|
|
27
|
+
/** The api key to use for authenticating against Twitter API as user. */
|
|
28
|
+
_apiKey;
|
|
29
|
+
/** Custom headers to use for all requests */
|
|
30
|
+
_customHeaders;
|
|
31
|
+
/** The service used to handle HTTP and API errors */
|
|
32
|
+
_errorHandler;
|
|
33
|
+
/** The guest key to use for authenticating against Twitter API as guest. */
|
|
34
|
+
_guestKey;
|
|
35
|
+
/** The URL To the proxy server to use for all others. */
|
|
36
|
+
_proxyUrl;
|
|
37
|
+
/** The max wait time for a response. */
|
|
38
|
+
_timeout;
|
|
39
|
+
/** The URL to the proxy server to use only for authentication. */
|
|
40
|
+
authProxyUrl;
|
|
41
|
+
/** The id of the authenticated user (if any). */
|
|
42
|
+
userId;
|
|
73
43
|
/**
|
|
74
44
|
* @param config - The config object for configuring the Rettiwt instance.
|
|
75
45
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
46
|
+
constructor(config) {
|
|
47
|
+
LogService_1.LogService.enabled = config?.logging ?? false;
|
|
48
|
+
this._apiKey = config?.apiKey;
|
|
49
|
+
this._guestKey = config?.guestKey;
|
|
50
|
+
this.userId = config?.apiKey ? AuthService_1.AuthService.getUserId(config.apiKey) : undefined;
|
|
51
|
+
this.authProxyUrl = config?.authProxyUrl ?? config?.proxyUrl;
|
|
52
|
+
this._proxyUrl = config?.proxyUrl;
|
|
53
|
+
this._timeout = config?.timeout ?? 0;
|
|
54
|
+
this._errorHandler = config?.errorHandler ?? new ErrorService_1.ErrorService();
|
|
55
|
+
this._customHeaders = config?.headers;
|
|
86
56
|
}
|
|
87
57
|
/**
|
|
88
58
|
* Checks the authorization status based on the requested resource.
|
|
@@ -91,42 +61,38 @@ var FetcherService = /** @class */ (function () {
|
|
|
91
61
|
*
|
|
92
62
|
* @throws An error if not authorized to access the requested resource.
|
|
93
63
|
*/
|
|
94
|
-
|
|
64
|
+
checkAuthorization(resource) {
|
|
95
65
|
// Logging
|
|
96
66
|
LogService_1.LogService.log(Logging_1.ELogActions.AUTHORIZATION, { authenticated: this.userId != undefined });
|
|
97
67
|
// Checking authorization status
|
|
98
68
|
if (!Groups_1.allowGuestAuthentication.includes(resource) && this.userId == undefined) {
|
|
99
69
|
throw new Error(Api_1.EApiErrors.RESOURCE_NOT_ALLOWED);
|
|
100
70
|
}
|
|
101
|
-
}
|
|
71
|
+
}
|
|
102
72
|
/**
|
|
103
73
|
* Returns the AuthCredentials based on the type of key present.
|
|
104
74
|
*
|
|
105
75
|
* @returns The generated AuthCredential
|
|
106
76
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
};
|
|
77
|
+
async getCredential() {
|
|
78
|
+
if (this._apiKey) {
|
|
79
|
+
// Logging
|
|
80
|
+
LogService_1.LogService.log(Logging_1.ELogActions.GET, { target: 'USER_CREDENTIAL' });
|
|
81
|
+
return new AuthCredential_1.AuthCredential(AuthService_1.AuthService.decodeCookie(this._apiKey)
|
|
82
|
+
.split(';')
|
|
83
|
+
.map((item) => new cookiejar_1.Cookie(item)));
|
|
84
|
+
}
|
|
85
|
+
else if (this._guestKey) {
|
|
86
|
+
// Logging
|
|
87
|
+
LogService_1.LogService.log(Logging_1.ELogActions.GET, { target: 'GUEST_CREDENTIAL' });
|
|
88
|
+
return new AuthCredential_1.AuthCredential(undefined, this._guestKey);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Logging
|
|
92
|
+
LogService_1.LogService.log(Logging_1.ELogActions.GET, { target: 'NEW_GUEST_CREDENTIAL' });
|
|
93
|
+
return await new AuthService_1.AuthService({ proxyUrl: this.authProxyUrl }).guest();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
130
96
|
/**
|
|
131
97
|
* Gets the https agent based on whether a proxy is used or not.
|
|
132
98
|
*
|
|
@@ -134,7 +100,7 @@ var FetcherService = /** @class */ (function () {
|
|
|
134
100
|
*
|
|
135
101
|
* @returns The https agent to use.
|
|
136
102
|
*/
|
|
137
|
-
|
|
103
|
+
getHttpsAgent(proxyUrl) {
|
|
138
104
|
if (proxyUrl) {
|
|
139
105
|
// Logging
|
|
140
106
|
LogService_1.LogService.log(Logging_1.ELogActions.GET, { target: 'HTTPS_PROXY_AGENT' });
|
|
@@ -145,7 +111,7 @@ var FetcherService = /** @class */ (function () {
|
|
|
145
111
|
LogService_1.LogService.log(Logging_1.ELogActions.GET, { target: 'HTTPS_AGENT' });
|
|
146
112
|
return new https_1.default.Agent();
|
|
147
113
|
}
|
|
148
|
-
}
|
|
114
|
+
}
|
|
149
115
|
/**
|
|
150
116
|
* Validates the given args against the given resource.
|
|
151
117
|
*
|
|
@@ -154,7 +120,7 @@ var FetcherService = /** @class */ (function () {
|
|
|
154
120
|
*
|
|
155
121
|
* @returns The validated args.
|
|
156
122
|
*/
|
|
157
|
-
|
|
123
|
+
validateArgs(resource, args) {
|
|
158
124
|
if (Groups_1.fetchResources.includes(resource)) {
|
|
159
125
|
// Logging
|
|
160
126
|
LogService_1.LogService.log(Logging_1.ELogActions.VALIDATE, { target: 'FETCH_ARGS' });
|
|
@@ -165,7 +131,7 @@ var FetcherService = /** @class */ (function () {
|
|
|
165
131
|
LogService_1.LogService.log(Logging_1.ELogActions.VALIDATE, { target: 'POST_ARGS' });
|
|
166
132
|
return new PostArgs_1.PostArgs(resource, args);
|
|
167
133
|
}
|
|
168
|
-
}
|
|
134
|
+
}
|
|
169
135
|
/**
|
|
170
136
|
* Makes an HTTP request according to the given parameters.
|
|
171
137
|
*
|
|
@@ -194,46 +160,35 @@ var FetcherService = /** @class */ (function () {
|
|
|
194
160
|
* })
|
|
195
161
|
* ```
|
|
196
162
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
error_1 = _a.sent();
|
|
228
|
-
// If error, delegate handling to error handler
|
|
229
|
-
this._errorHandler.handle(error_1);
|
|
230
|
-
throw error_1;
|
|
231
|
-
case 5: return [2 /*return*/];
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
return FetcherService;
|
|
237
|
-
}());
|
|
163
|
+
async request(resource, args) {
|
|
164
|
+
// Logging
|
|
165
|
+
LogService_1.LogService.log(Logging_1.ELogActions.REQUEST, { resource: resource, args: args });
|
|
166
|
+
// Checking authorization for the requested resource
|
|
167
|
+
this.checkAuthorization(resource);
|
|
168
|
+
// Validating args
|
|
169
|
+
args = this.validateArgs(resource, args);
|
|
170
|
+
// Getting HTTPS agent
|
|
171
|
+
const httpsAgent = this.getHttpsAgent(this._proxyUrl);
|
|
172
|
+
// Getting credentials from key
|
|
173
|
+
const cred = await this.getCredential();
|
|
174
|
+
// Getting request configuration
|
|
175
|
+
const config = Requests_1.requests[resource](args);
|
|
176
|
+
// Setting additional request parameters
|
|
177
|
+
config.headers = { ...config.headers, ...cred.toHeader(), ...(this._customHeaders || {}) };
|
|
178
|
+
config.httpAgent = httpsAgent;
|
|
179
|
+
config.httpsAgent = httpsAgent;
|
|
180
|
+
config.timeout = this._timeout;
|
|
181
|
+
// Sending the request
|
|
182
|
+
try {
|
|
183
|
+
// Returning the reponse body
|
|
184
|
+
return (await (0, axios_1.default)(config)).data;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
// If error, delegate handling to error handler
|
|
188
|
+
this._errorHandler.handle(error);
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
238
193
|
exports.FetcherService = FetcherService;
|
|
239
194
|
//# sourceMappingURL=FetcherService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../../src/services/public/FetcherService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../../src/services/public/FetcherService.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAqC;AAErC,kDAA0B;AAC1B,yCAAmC;AACnC,yDAAoD;AAEpD,qDAAmG;AACnG,yDA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D,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAElC,kBAAkB;QAClB,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAE,CAAC;QAE1C,sBAAsB;QACtB,MAAM,UAAU,GAAU,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE7D,+BAA+B;QAC/B,MAAM,IAAI,GAAmB,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAExD,gCAAgC;QAChC,MAAM,MAAM,GAAG,mBAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;QAExC,wCAAwC;QACxC,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC,EAAE,CAAC;QAC3F,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC;QAC9B,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;QAC/B,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE/B,sBAAsB;QACtB,IAAI,CAAC;YACJ,6BAA6B;YAC7B,OAAO,CAAC,MAAM,IAAA,eAAK,EAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,+CAA+C;YAC/C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjC,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD;AA/LD,wCA+LC"}
|
|
@@ -1,69 +1,17 @@
|
|
|
1
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.ListService = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
__extends(ListService, _super);
|
|
4
|
+
const Extractors_1 = require("../../collections/Extractors");
|
|
5
|
+
const Resource_1 = require("../../enums/Resource");
|
|
6
|
+
const FetcherService_1 = require("./FetcherService");
|
|
7
|
+
class ListService extends FetcherService_1.FetcherService {
|
|
60
8
|
/**
|
|
61
9
|
* @param config - The config object for configuring the Rettiwt instance.
|
|
62
10
|
*
|
|
63
11
|
* @internal
|
|
64
12
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
67
15
|
}
|
|
68
16
|
/**
|
|
69
17
|
* Get the list of members of a tweet list.
|
|
@@ -93,26 +41,18 @@ var ListService = /** @class */ (function (_super) {
|
|
|
93
41
|
*
|
|
94
42
|
* @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
|
|
95
43
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return [4 /*yield*/, this.request(resource, {
|
|
104
|
-
id: id,
|
|
105
|
-
count: count,
|
|
106
|
-
cursor: cursor,
|
|
107
|
-
})];
|
|
108
|
-
case 1:
|
|
109
|
-
response = _a.sent();
|
|
110
|
-
data = Extractors_1.extractors[resource](response);
|
|
111
|
-
return [2 /*return*/, data];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
44
|
+
async members(id, count, cursor) {
|
|
45
|
+
const resource = Resource_1.EResourceType.LIST_MEMBERS;
|
|
46
|
+
// Fetching the raw list of members
|
|
47
|
+
const response = await this.request(resource, {
|
|
48
|
+
id: id,
|
|
49
|
+
count: count,
|
|
50
|
+
cursor: cursor,
|
|
114
51
|
});
|
|
115
|
-
|
|
52
|
+
// Deserializing response
|
|
53
|
+
const data = Extractors_1.extractors[resource](response);
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
116
56
|
/**
|
|
117
57
|
* Get the list of tweets from a tweet list.
|
|
118
58
|
*
|
|
@@ -141,29 +81,20 @@ var ListService = /** @class */ (function (_super) {
|
|
|
141
81
|
*
|
|
142
82
|
* @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
|
|
143
83
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return [4 /*yield*/, this.request(resource, {
|
|
152
|
-
id: id,
|
|
153
|
-
count: count,
|
|
154
|
-
cursor: cursor,
|
|
155
|
-
})];
|
|
156
|
-
case 1:
|
|
157
|
-
response = _a.sent();
|
|
158
|
-
data = Extractors_1.extractors[resource](response);
|
|
159
|
-
// Sorting the tweets by date, from recent to oldest
|
|
160
|
-
data.list.sort(function (a, b) { return new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf(); });
|
|
161
|
-
return [2 /*return*/, data];
|
|
162
|
-
}
|
|
163
|
-
});
|
|
84
|
+
async tweets(id, count, cursor) {
|
|
85
|
+
const resource = Resource_1.EResourceType.LIST_TWEETS;
|
|
86
|
+
// Fetching raw list tweets
|
|
87
|
+
const response = await this.request(resource, {
|
|
88
|
+
id: id,
|
|
89
|
+
count: count,
|
|
90
|
+
cursor: cursor,
|
|
164
91
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
92
|
+
// Deserializing response
|
|
93
|
+
const data = Extractors_1.extractors[resource](response);
|
|
94
|
+
// Sorting the tweets by date, from recent to oldest
|
|
95
|
+
data.list.sort((a, b) => new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf());
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
168
99
|
exports.ListService = ListService;
|
|
169
100
|
//# sourceMappingURL=ListService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListService.js","sourceRoot":"","sources":["../../../src/services/public/ListService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ListService.js","sourceRoot":"","sources":["../../../src/services/public/ListService.ts"],"names":[],"mappings":";;;AAEA,6DAA0D;AAC1D,mDAAqD;AAMrD,qDAAkD;AAElD,MAAa,WAAY,SAAQ,+BAAc;IAC9C;;;;OAIG;IACH,YAAmB,MAAuB;QACzC,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACI,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,KAAc,EAAE,MAAe;QAC/D,MAAM,QAAQ,GAAkB,wBAAa,CAAC,YAAY,CAAC;QAE3D,mCAAmC;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAuB,QAAQ,EAAE;YACnE,EAAE,EAAE,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACd,CAAC,CAAC;QAEH,yBAAyB;QACzB,MAAM,IAAI,GAAG,uBAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;QAE5C,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACI,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAc,EAAE,MAAe;QAC9D,MAAM,QAAQ,GAAG,wBAAa,CAAC,WAAW,CAAC;QAE3C,2BAA2B;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAsB,QAAQ,EAAE;YAClE,EAAE,EAAE,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACd,CAAC,CAAC;QAEH,yBAAyB;QACzB,MAAM,IAAI,GAAG,uBAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;QAE5C,oDAAoD;QACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAE5F,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AApGD,kCAoGC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ESearchResultType, TweetFilter } from 'rettiwt-core';
|
|
2
|
-
import { TweetArgs } from '../../models/args/PostArgs';
|
|
1
|
+
import { ESearchResultType, INewTweet, TweetFilter } from 'rettiwt-core';
|
|
3
2
|
import { CursoredData } from '../../models/data/CursoredData';
|
|
4
3
|
import { Tweet } from '../../models/data/Tweet';
|
|
5
4
|
import { User } from '../../models/data/User';
|
|
@@ -177,7 +176,33 @@ export declare class TweetService extends FetcherService {
|
|
|
177
176
|
* });
|
|
178
177
|
* ```
|
|
179
178
|
*/
|
|
180
|
-
post(options:
|
|
179
|
+
post(options: INewTweet): Promise<string | undefined>;
|
|
180
|
+
/**
|
|
181
|
+
* Get the list of replies to a tweet.
|
|
182
|
+
*
|
|
183
|
+
* @param id - The id of the target tweet.
|
|
184
|
+
* @param cursor - The cursor to the batch of replies to fetch.
|
|
185
|
+
*
|
|
186
|
+
* @returns The list of replies to the given tweet.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```
|
|
190
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
191
|
+
*
|
|
192
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
193
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
194
|
+
*
|
|
195
|
+
* // Fetching the first 100 replies to the Tweet with id '1234567890'
|
|
196
|
+
* rettiwt.tweet.replies('1234567890')
|
|
197
|
+
* .then(res => {
|
|
198
|
+
* console.log(res);
|
|
199
|
+
* })
|
|
200
|
+
* .catch(err => {
|
|
201
|
+
* console.log(err);
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
replies(id: string, cursor?: string): Promise<CursoredData<Tweet>>;
|
|
181
206
|
/**
|
|
182
207
|
* Retweet a tweet.
|
|
183
208
|
*
|
|
@@ -258,7 +283,7 @@ export declare class TweetService extends FetcherService {
|
|
|
258
283
|
* @remarks
|
|
259
284
|
* Scheduling a tweet is similar to {@link post}ing, except that an extra parameter called `scheduleFor` is used.
|
|
260
285
|
*/
|
|
261
|
-
schedule(options:
|
|
286
|
+
schedule(options: INewTweet): Promise<string | undefined>;
|
|
262
287
|
/**
|
|
263
288
|
* Search for tweets using a filter.
|
|
264
289
|
*
|