rettiwt-api 2.7.1 → 3.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/.eslintrc.js +73 -5
- package/.tool-versions +1 -0
- package/README.md +87 -20
- package/dist/Rettiwt.js +0 -1
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +2 -4
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +37 -0
- package/dist/collections/Extractors.js +67 -0
- package/dist/collections/Extractors.js.map +1 -0
- package/dist/collections/Groups.d.ts +19 -0
- package/dist/collections/Groups.js +55 -0
- package/dist/collections/Groups.js.map +1 -0
- package/dist/collections/Requests.d.ts +12 -0
- package/dist/collections/Requests.js +46 -0
- package/dist/collections/Requests.js.map +1 -0
- package/dist/commands/Auth.d.ts +6 -0
- package/dist/commands/Auth.js +26 -8
- package/dist/commands/Auth.js.map +1 -1
- package/dist/commands/Tweet.js +237 -82
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +197 -36
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Api.d.ts +30 -0
- package/dist/enums/Api.js +32 -1
- package/dist/enums/Api.js.map +1 -1
- package/dist/enums/Data.d.ts +9 -0
- package/dist/enums/Data.js +14 -0
- package/dist/enums/Data.js.map +1 -0
- package/dist/enums/Http.d.ts +1 -1
- package/dist/enums/Http.js +1 -1
- package/dist/enums/Logging.d.ts +6 -5
- package/dist/enums/Logging.js +6 -5
- package/dist/enums/Logging.js.map +1 -1
- package/dist/enums/Resource.d.ts +33 -0
- package/dist/enums/Resource.js +42 -0
- package/dist/enums/Resource.js.map +1 -0
- package/dist/helper/CliUtils.d.ts +1 -1
- package/dist/helper/CliUtils.js.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +129 -0
- package/dist/models/args/FetchArgs.js +263 -0
- package/dist/models/args/FetchArgs.js.map +1 -0
- package/dist/models/args/PostArgs.d.ts +116 -0
- package/dist/models/args/PostArgs.js +232 -0
- package/dist/models/args/PostArgs.js.map +1 -0
- package/dist/models/data/CursoredData.d.ts +11 -11
- package/dist/models/data/CursoredData.js +21 -16
- package/dist/models/data/CursoredData.js.map +1 -1
- package/dist/models/data/List.d.ts +8 -10
- package/dist/models/data/List.js +2 -4
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +44 -29
- package/dist/models/data/Tweet.js +74 -15
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +38 -20
- package/dist/models/data/User.js +71 -7
- package/dist/models/data/User.js.map +1 -1
- package/dist/models/errors/ApiError.d.ts +1 -3
- package/dist/models/errors/ApiError.js +1 -4
- package/dist/models/errors/ApiError.js.map +1 -1
- package/dist/models/errors/DataValidationError.d.ts +30 -0
- package/dist/models/errors/DataValidationError.js +34 -0
- package/dist/models/errors/DataValidationError.js.map +1 -0
- package/dist/models/errors/HttpError.d.ts +1 -3
- package/dist/models/errors/HttpError.js +1 -4
- package/dist/models/errors/HttpError.js.map +1 -1
- package/dist/models/errors/TimeoutError.d.ts +2 -4
- package/dist/models/errors/TimeoutError.js +2 -5
- package/dist/models/errors/TimeoutError.js.map +1 -1
- package/dist/services/internal/ErrorService.d.ts +45 -35
- package/dist/services/internal/ErrorService.js +70 -68
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/LogService.d.ts +7 -5
- package/dist/services/internal/LogService.js +28 -9
- package/dist/services/internal/LogService.js.map +1 -1
- package/dist/services/public/AuthService.d.ts +24 -20
- package/dist/services/public/AuthService.js +38 -36
- package/dist/services/public/AuthService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +89 -0
- package/dist/services/public/FetcherService.js +240 -0
- package/dist/services/public/FetcherService.js.map +1 -0
- package/dist/services/public/TweetService.d.ts +213 -94
- package/dist/services/public/TweetService.js +409 -209
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +185 -52
- package/dist/services/public/UserService.js +338 -103
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/ReturnTypes.d.ts +21 -0
- package/dist/types/ReturnTypes.js +3 -0
- package/dist/types/ReturnTypes.js.map +1 -0
- package/package.json +4 -2
- package/src/Rettiwt.ts +0 -3
- package/src/cli.ts +2 -4
- package/src/collections/Extractors.ts +84 -0
- package/src/collections/Groups.ts +54 -0
- package/src/collections/Requests.ts +52 -0
- package/src/commands/Auth.ts +19 -7
- package/src/commands/Tweet.ts +179 -91
- package/src/commands/User.ts +118 -25
- package/src/enums/Api.ts +31 -0
- package/src/enums/Data.ts +9 -0
- package/src/enums/Http.ts +1 -1
- package/src/enums/Logging.ts +6 -5
- package/src/enums/Resource.ts +40 -0
- package/src/helper/CliUtils.ts +1 -1
- package/src/index.ts +41 -14
- package/src/models/args/FetchArgs.ts +296 -0
- package/src/models/args/PostArgs.ts +263 -0
- package/src/models/data/CursoredData.ts +23 -15
- package/src/models/data/List.ts +12 -15
- package/src/models/data/Tweet.ts +108 -39
- package/src/models/data/User.ts +99 -30
- package/src/models/errors/ApiError.ts +1 -4
- package/src/models/errors/DataValidationError.ts +44 -0
- package/src/models/errors/HttpError.ts +1 -4
- package/src/models/errors/TimeoutError.ts +2 -5
- package/src/services/internal/ErrorService.ts +76 -75
- package/src/services/internal/LogService.ts +20 -10
- package/src/services/public/AuthService.ts +39 -38
- package/src/services/public/FetcherService.ts +209 -0
- package/src/services/public/TweetService.ts +384 -179
- package/src/services/public/UserService.ts +319 -86
- package/src/types/RettiwtConfig.ts +0 -1
- package/src/types/ReturnTypes.ts +24 -0
- package/dist/models/args/TweetArgs.d.ts +0 -44
- package/dist/models/args/TweetArgs.js +0 -82
- package/dist/models/args/TweetArgs.js.map +0 -1
- package/dist/models/data/Media.d.ts +0 -14
- package/dist/models/data/Media.js +0 -19
- package/dist/models/data/Media.js.map +0 -1
- package/dist/services/internal/FetcherService.d.ts +0 -106
- package/dist/services/internal/FetcherService.js +0 -365
- package/dist/services/internal/FetcherService.js.map +0 -1
- package/src/models/args/TweetArgs.ts +0 -98
- package/src/models/data/Media.ts +0 -19
- package/src/services/internal/FetcherService.ts +0 -365
|
@@ -52,12 +52,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.UserService = void 0;
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
var FetcherService_1 = require("../internal/FetcherService");
|
|
55
|
+
var Extractors_1 = require("../../collections/Extractors");
|
|
56
|
+
var Resource_1 = require("../../enums/Resource");
|
|
57
|
+
var FetcherService_1 = require("./FetcherService");
|
|
59
58
|
/**
|
|
60
|
-
* Handles
|
|
59
|
+
* Handles interacting with resources related to user account
|
|
61
60
|
*
|
|
62
61
|
* @public
|
|
63
62
|
*/
|
|
@@ -75,9 +74,13 @@ var UserService = /** @class */ (function (_super) {
|
|
|
75
74
|
* Get the details of a user.
|
|
76
75
|
*
|
|
77
76
|
* @param id - The username/id of the target user.
|
|
78
|
-
* @returns The details of the given user.
|
|
79
77
|
*
|
|
80
|
-
* @
|
|
78
|
+
* @returns
|
|
79
|
+
* The details of the given user.
|
|
80
|
+
* If no user matches the given id, returns `undefined`.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* Fetching the details using username
|
|
81
84
|
* ```
|
|
82
85
|
* import { Rettiwt } from 'rettiwt-api';
|
|
83
86
|
*
|
|
@@ -94,15 +97,16 @@ var UserService = /** @class */ (function (_super) {
|
|
|
94
97
|
* });
|
|
95
98
|
* ```
|
|
96
99
|
*
|
|
97
|
-
* @example
|
|
100
|
+
* @example
|
|
101
|
+
* Fetching the details using id
|
|
98
102
|
* ```
|
|
99
103
|
* import { Rettiwt } from 'rettiwt-api';
|
|
100
104
|
*
|
|
101
105
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
102
106
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
103
107
|
*
|
|
104
|
-
* // Fetching the details of the User with id '
|
|
105
|
-
* rettiwt.user.details('
|
|
108
|
+
* // Fetching the details of the User with id '1234567890'
|
|
109
|
+
* rettiwt.user.details('1234567890')
|
|
106
110
|
* .then(res => {
|
|
107
111
|
* console.log(res);
|
|
108
112
|
* })
|
|
@@ -110,37 +114,126 @@ var UserService = /** @class */ (function (_super) {
|
|
|
110
114
|
* console.log(err);
|
|
111
115
|
* });
|
|
112
116
|
* ```
|
|
113
|
-
*
|
|
114
|
-
* @public
|
|
115
117
|
*/
|
|
116
118
|
UserService.prototype.details = function (id) {
|
|
117
119
|
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var data;
|
|
120
|
+
var resource, response, data;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
// If username is given
|
|
125
|
+
if (isNaN(Number(id))) {
|
|
126
|
+
resource = Resource_1.EResourceType.USER_DETAILS_BY_USERNAME;
|
|
127
|
+
}
|
|
128
|
+
// If id is given
|
|
129
|
+
else {
|
|
130
|
+
resource = Resource_1.EResourceType.USER_DETAILS_BY_ID;
|
|
131
|
+
}
|
|
132
|
+
return [4 /*yield*/, this.request(resource, { id: id })];
|
|
133
|
+
case 1:
|
|
134
|
+
response = _a.sent();
|
|
135
|
+
data = Extractors_1.extractors[resource](response);
|
|
136
|
+
return [2 /*return*/, data];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Follow a user.
|
|
143
|
+
*
|
|
144
|
+
* @param id - The id the user to be followed.
|
|
145
|
+
*
|
|
146
|
+
* @returns Whether following was successful or not.
|
|
147
|
+
*
|
|
148
|
+
* @throws Code 108 if given user id is invalid.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```
|
|
152
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
153
|
+
*
|
|
154
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
155
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
156
|
+
*
|
|
157
|
+
* // Following the User with id '1234567890'
|
|
158
|
+
* rettiwt.user.follow('1234567890')
|
|
159
|
+
* .then(res => {
|
|
160
|
+
* console.log(res);
|
|
161
|
+
* })
|
|
162
|
+
* .catch(err => {
|
|
163
|
+
* console.log(err);
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
UserService.prototype.follow = function (id) {
|
|
168
|
+
var _a;
|
|
169
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
170
|
+
var resource, response, data;
|
|
171
|
+
return __generator(this, function (_b) {
|
|
172
|
+
switch (_b.label) {
|
|
173
|
+
case 0:
|
|
174
|
+
resource = Resource_1.EResourceType.USER_FOLLOW;
|
|
175
|
+
return [4 /*yield*/, this.request(Resource_1.EResourceType.USER_FOLLOW, { id: id })];
|
|
176
|
+
case 1:
|
|
177
|
+
response = _b.sent();
|
|
178
|
+
data = (_a = Extractors_1.extractors[resource](response)) !== null && _a !== void 0 ? _a : false;
|
|
179
|
+
return [2 /*return*/, data];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Get the list followers of a user.
|
|
186
|
+
*
|
|
187
|
+
* @param id - The id of the target user.
|
|
188
|
+
* @param count - The number of followers to fetch, must be \<= 100.
|
|
189
|
+
* @param cursor - The cursor to the batch of followers to fetch.
|
|
190
|
+
*
|
|
191
|
+
* @returns The list of users following the target user.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```
|
|
195
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
196
|
+
*
|
|
197
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
198
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
199
|
+
*
|
|
200
|
+
* // Fetching the first 100 followers of the User with id '1234567890'
|
|
201
|
+
* rettiwt.user.followers('1234567890')
|
|
202
|
+
* .then(res => {
|
|
203
|
+
* console.log(res);
|
|
204
|
+
* })
|
|
205
|
+
* .catch(err => {
|
|
206
|
+
* console.log(err);
|
|
207
|
+
* });
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
UserService.prototype.followers = function (id, count, cursor) {
|
|
211
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
212
|
+
var resource, response, data;
|
|
119
213
|
return __generator(this, function (_a) {
|
|
120
214
|
switch (_a.label) {
|
|
121
215
|
case 0:
|
|
122
|
-
|
|
123
|
-
return [4 /*yield*/, this.
|
|
216
|
+
resource = Resource_1.EResourceType.USER_FOLLOWERS;
|
|
217
|
+
return [4 /*yield*/, this.request(resource, {
|
|
218
|
+
id: id,
|
|
219
|
+
count: count,
|
|
220
|
+
cursor: cursor,
|
|
221
|
+
})];
|
|
124
222
|
case 1:
|
|
125
|
-
|
|
126
|
-
data =
|
|
127
|
-
return [
|
|
128
|
-
case 2: return [4 /*yield*/, this.fetch(rettiwt_core_1.EResourceType.USER_DETAILS_BY_ID, { id: id })];
|
|
129
|
-
case 3:
|
|
130
|
-
// Fetching the requested data
|
|
131
|
-
data = _a.sent();
|
|
132
|
-
_a.label = 4;
|
|
133
|
-
case 4: return [2 /*return*/, data.list[0]];
|
|
223
|
+
response = _a.sent();
|
|
224
|
+
data = Extractors_1.extractors[resource](response);
|
|
225
|
+
return [2 /*return*/, data];
|
|
134
226
|
}
|
|
135
227
|
});
|
|
136
228
|
});
|
|
137
229
|
};
|
|
138
230
|
/**
|
|
139
|
-
* Get the list of users who are followed by
|
|
231
|
+
* Get the list of users who are followed by a user.
|
|
140
232
|
*
|
|
141
|
-
* @param
|
|
233
|
+
* @param id - The id of the target user.
|
|
142
234
|
* @param count - The number of following to fetch, must be \<= 100.
|
|
143
235
|
* @param cursor - The cursor to the batch of following to fetch.
|
|
236
|
+
*
|
|
144
237
|
* @returns The list of users followed by the target user.
|
|
145
238
|
*
|
|
146
239
|
* @example
|
|
@@ -150,8 +243,8 @@ var UserService = /** @class */ (function (_super) {
|
|
|
150
243
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
151
244
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
152
245
|
*
|
|
153
|
-
* // Fetching the first 100 following of the User with id '
|
|
154
|
-
* rettiwt.user.following('
|
|
246
|
+
* // Fetching the first 100 following of the User with id '1234567890'
|
|
247
|
+
* rettiwt.user.following('1234567890')
|
|
155
248
|
* .then(res => {
|
|
156
249
|
* console.log(res);
|
|
157
250
|
* })
|
|
@@ -159,33 +252,35 @@ var UserService = /** @class */ (function (_super) {
|
|
|
159
252
|
* console.log(err);
|
|
160
253
|
* });
|
|
161
254
|
* ```
|
|
162
|
-
*
|
|
163
|
-
* @public
|
|
164
255
|
*/
|
|
165
|
-
UserService.prototype.following = function (
|
|
256
|
+
UserService.prototype.following = function (id, count, cursor) {
|
|
166
257
|
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
-
var data;
|
|
258
|
+
var resource, response, data;
|
|
168
259
|
return __generator(this, function (_a) {
|
|
169
260
|
switch (_a.label) {
|
|
170
|
-
case 0:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
261
|
+
case 0:
|
|
262
|
+
resource = Resource_1.EResourceType.USER_FOLLOWING;
|
|
263
|
+
return [4 /*yield*/, this.request(resource, {
|
|
264
|
+
id: id,
|
|
265
|
+
count: count,
|
|
266
|
+
cursor: cursor,
|
|
267
|
+
})];
|
|
175
268
|
case 1:
|
|
176
|
-
|
|
269
|
+
response = _a.sent();
|
|
270
|
+
data = Extractors_1.extractors[resource](response);
|
|
177
271
|
return [2 /*return*/, data];
|
|
178
272
|
}
|
|
179
273
|
});
|
|
180
274
|
});
|
|
181
275
|
};
|
|
182
276
|
/**
|
|
183
|
-
* Get the
|
|
277
|
+
* Get the highlighted tweets of a user.
|
|
184
278
|
*
|
|
185
|
-
* @param
|
|
279
|
+
* @param id - The id of the target user.
|
|
186
280
|
* @param count - The number of followers to fetch, must be \<= 100.
|
|
187
281
|
* @param cursor - The cursor to the batch of followers to fetch.
|
|
188
|
-
*
|
|
282
|
+
*
|
|
283
|
+
* @returns The list of highlighted tweets of the target user.
|
|
189
284
|
*
|
|
190
285
|
* @example
|
|
191
286
|
* ```
|
|
@@ -194,8 +289,8 @@ var UserService = /** @class */ (function (_super) {
|
|
|
194
289
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
195
290
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
196
291
|
*
|
|
197
|
-
* // Fetching the
|
|
198
|
-
* rettiwt.user.
|
|
292
|
+
* // Fetching the top 100 highlights of the User with id '1234567890'
|
|
293
|
+
* rettiwt.user.highlights('1234567890')
|
|
199
294
|
* .then(res => {
|
|
200
295
|
* console.log(res);
|
|
201
296
|
* })
|
|
@@ -203,32 +298,34 @@ var UserService = /** @class */ (function (_super) {
|
|
|
203
298
|
* console.log(err);
|
|
204
299
|
* });
|
|
205
300
|
* ```
|
|
206
|
-
*
|
|
207
|
-
* @public
|
|
208
301
|
*/
|
|
209
|
-
UserService.prototype.
|
|
302
|
+
UserService.prototype.highlights = function (id, count, cursor) {
|
|
210
303
|
return __awaiter(this, void 0, void 0, function () {
|
|
211
|
-
var data;
|
|
304
|
+
var resource, response, data;
|
|
212
305
|
return __generator(this, function (_a) {
|
|
213
306
|
switch (_a.label) {
|
|
214
|
-
case 0:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
307
|
+
case 0:
|
|
308
|
+
resource = Resource_1.EResourceType.USER_HIGHLIGHTS;
|
|
309
|
+
return [4 /*yield*/, this.request(resource, {
|
|
310
|
+
id: id,
|
|
311
|
+
count: count,
|
|
312
|
+
cursor: cursor,
|
|
313
|
+
})];
|
|
219
314
|
case 1:
|
|
220
|
-
|
|
315
|
+
response = _a.sent();
|
|
316
|
+
data = Extractors_1.extractors[resource](response);
|
|
221
317
|
return [2 /*return*/, data];
|
|
222
318
|
}
|
|
223
319
|
});
|
|
224
320
|
});
|
|
225
321
|
};
|
|
226
322
|
/**
|
|
227
|
-
* Get the list of tweets liked by
|
|
323
|
+
* Get the list of tweets liked by a user.
|
|
228
324
|
*
|
|
229
|
-
* @param
|
|
325
|
+
* @param id - The id of the target user.
|
|
230
326
|
* @param count - The number of likes to fetch, must be \<= 100.
|
|
231
327
|
* @param cursor - The cursor to the batch of likes to fetch.
|
|
328
|
+
*
|
|
232
329
|
* @returns The list of tweets liked by the target user.
|
|
233
330
|
*
|
|
234
331
|
* @example
|
|
@@ -238,8 +335,8 @@ var UserService = /** @class */ (function (_super) {
|
|
|
238
335
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
239
336
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
240
337
|
*
|
|
241
|
-
* // Fetching the most recent 100 liked Tweets of the User with id '
|
|
242
|
-
* rettiwt.user.likes('
|
|
338
|
+
* // Fetching the most recent 100 liked Tweets of the User with id '1234567890'
|
|
339
|
+
* rettiwt.user.likes('1234567890')
|
|
243
340
|
* .then(res => {
|
|
244
341
|
* console.log(res);
|
|
245
342
|
* })
|
|
@@ -247,33 +344,35 @@ var UserService = /** @class */ (function (_super) {
|
|
|
247
344
|
* console.log(err);
|
|
248
345
|
* });
|
|
249
346
|
* ```
|
|
250
|
-
*
|
|
251
|
-
* @public
|
|
252
347
|
*/
|
|
253
|
-
UserService.prototype.likes = function (
|
|
348
|
+
UserService.prototype.likes = function (id, count, cursor) {
|
|
254
349
|
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
-
var data;
|
|
350
|
+
var resource, response, data;
|
|
256
351
|
return __generator(this, function (_a) {
|
|
257
352
|
switch (_a.label) {
|
|
258
|
-
case 0:
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
353
|
+
case 0:
|
|
354
|
+
resource = Resource_1.EResourceType.USER_LIKES;
|
|
355
|
+
return [4 /*yield*/, this.request(resource, {
|
|
356
|
+
id: id,
|
|
357
|
+
count: count,
|
|
358
|
+
cursor: cursor,
|
|
359
|
+
})];
|
|
263
360
|
case 1:
|
|
264
|
-
|
|
361
|
+
response = _a.sent();
|
|
362
|
+
data = Extractors_1.extractors[resource](response);
|
|
265
363
|
return [2 /*return*/, data];
|
|
266
364
|
}
|
|
267
365
|
});
|
|
268
366
|
});
|
|
269
367
|
};
|
|
270
368
|
/**
|
|
271
|
-
* Get the timeline of
|
|
369
|
+
* Get the media timeline of a user
|
|
272
370
|
*
|
|
273
|
-
* @param
|
|
274
|
-
* @param count - The number of
|
|
275
|
-
* @param cursor - The cursor to the batch of
|
|
276
|
-
*
|
|
371
|
+
* @param id - The id of the target user.
|
|
372
|
+
* @param count - The number of media to fetch, must be \<= 100.
|
|
373
|
+
* @param cursor - The cursor to the batch of media to fetch
|
|
374
|
+
*
|
|
375
|
+
* @returns The media timeline of the target user.
|
|
277
376
|
*
|
|
278
377
|
* @example
|
|
279
378
|
* ```
|
|
@@ -282,8 +381,8 @@ var UserService = /** @class */ (function (_super) {
|
|
|
282
381
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
283
382
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
284
383
|
*
|
|
285
|
-
* // Fetching the first
|
|
286
|
-
* rettiwt.user.timeline('
|
|
384
|
+
* // Fetching the first 100 timeline media tweets of the User with id '1234567890'
|
|
385
|
+
* rettiwt.user.timeline('1234567890')
|
|
287
386
|
* .then(res => {
|
|
288
387
|
* console.log(res);
|
|
289
388
|
* })
|
|
@@ -291,36 +390,34 @@ var UserService = /** @class */ (function (_super) {
|
|
|
291
390
|
* console.log(err);
|
|
292
391
|
* });
|
|
293
392
|
* ```
|
|
294
|
-
*
|
|
295
|
-
* @remarks
|
|
296
|
-
* - If the target user has a pinned tweet, the returned timeline has one item extra and this is always the pinned tweet.
|
|
297
|
-
* - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
|
|
298
|
-
*
|
|
299
|
-
* @public
|
|
300
393
|
*/
|
|
301
|
-
UserService.prototype.
|
|
394
|
+
UserService.prototype.media = function (id, count, cursor) {
|
|
302
395
|
return __awaiter(this, void 0, void 0, function () {
|
|
303
|
-
var data;
|
|
396
|
+
var resource, response, data;
|
|
304
397
|
return __generator(this, function (_a) {
|
|
305
398
|
switch (_a.label) {
|
|
306
|
-
case 0:
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
399
|
+
case 0:
|
|
400
|
+
resource = Resource_1.EResourceType.USER_MEDIA;
|
|
401
|
+
return [4 /*yield*/, this.request(resource, {
|
|
402
|
+
id: id,
|
|
403
|
+
count: count,
|
|
404
|
+
cursor: cursor,
|
|
405
|
+
})];
|
|
311
406
|
case 1:
|
|
312
|
-
|
|
407
|
+
response = _a.sent();
|
|
408
|
+
data = Extractors_1.extractors[resource](response);
|
|
313
409
|
return [2 /*return*/, data];
|
|
314
410
|
}
|
|
315
411
|
});
|
|
316
412
|
});
|
|
317
413
|
};
|
|
318
414
|
/**
|
|
319
|
-
* Get the reply timeline of
|
|
415
|
+
* Get the reply timeline of a user.
|
|
320
416
|
*
|
|
321
|
-
* @param
|
|
417
|
+
* @param id - The id of the target user.
|
|
322
418
|
* @param count - The number of replies to fetch, must be \<= 20.
|
|
323
419
|
* @param cursor - The cursor to the batch of replies to fetch.
|
|
420
|
+
*
|
|
324
421
|
* @returns The reply timeline of the target user.
|
|
325
422
|
*
|
|
326
423
|
* @example
|
|
@@ -330,8 +427,8 @@ var UserService = /** @class */ (function (_super) {
|
|
|
330
427
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
331
428
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
332
429
|
*
|
|
333
|
-
* // Fetching the first 100 timeline replies of the User with id '
|
|
334
|
-
* rettiwt.user.replies('
|
|
430
|
+
* // Fetching the first 100 timeline replies of the User with id '1234567890'
|
|
431
|
+
* rettiwt.user.replies('1234567890')
|
|
335
432
|
* .then(res => {
|
|
336
433
|
* console.log(res);
|
|
337
434
|
* })
|
|
@@ -341,23 +438,161 @@ var UserService = /** @class */ (function (_super) {
|
|
|
341
438
|
* ```
|
|
342
439
|
*
|
|
343
440
|
* @remarks If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
|
|
441
|
+
*/
|
|
442
|
+
UserService.prototype.replies = function (id, count, cursor) {
|
|
443
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
444
|
+
var resource, response, data;
|
|
445
|
+
return __generator(this, function (_a) {
|
|
446
|
+
switch (_a.label) {
|
|
447
|
+
case 0:
|
|
448
|
+
resource = Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES;
|
|
449
|
+
return [4 /*yield*/, this.request(resource, {
|
|
450
|
+
id: id,
|
|
451
|
+
count: count,
|
|
452
|
+
cursor: cursor,
|
|
453
|
+
})];
|
|
454
|
+
case 1:
|
|
455
|
+
response = _a.sent();
|
|
456
|
+
data = Extractors_1.extractors[resource](response);
|
|
457
|
+
return [2 /*return*/, data];
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* Get the list of subscriptions of a user.
|
|
464
|
+
*
|
|
465
|
+
* @param id - The id of the target user.
|
|
466
|
+
* @param count - The number of subscriptions to fetch, must be \<= 100.
|
|
467
|
+
* @param cursor - The cursor to the batch of subscriptions to fetch.
|
|
344
468
|
*
|
|
345
|
-
* @
|
|
469
|
+
* @returns The list of subscriptions by the target user.
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```
|
|
473
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
474
|
+
*
|
|
475
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
476
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
477
|
+
*
|
|
478
|
+
* // Fetching the first 100 subscriptions of the User with id '1234567890'
|
|
479
|
+
* rettiwt.user.subscriptions('1234567890')
|
|
480
|
+
* .then(res => {
|
|
481
|
+
* console.log(res);
|
|
482
|
+
* })
|
|
483
|
+
* .catch(err => {
|
|
484
|
+
* console.log(err);
|
|
485
|
+
* });
|
|
486
|
+
* ```
|
|
346
487
|
*/
|
|
347
|
-
UserService.prototype.
|
|
488
|
+
UserService.prototype.subscriptions = function (id, count, cursor) {
|
|
348
489
|
return __awaiter(this, void 0, void 0, function () {
|
|
349
|
-
var data;
|
|
490
|
+
var resource, response, data;
|
|
350
491
|
return __generator(this, function (_a) {
|
|
351
492
|
switch (_a.label) {
|
|
352
|
-
case 0:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
493
|
+
case 0:
|
|
494
|
+
resource = Resource_1.EResourceType.USER_SUBSCRIPTIONS;
|
|
495
|
+
return [4 /*yield*/, this.request(resource, {
|
|
496
|
+
id: id,
|
|
497
|
+
count: count,
|
|
498
|
+
cursor: cursor,
|
|
499
|
+
})];
|
|
500
|
+
case 1:
|
|
501
|
+
response = _a.sent();
|
|
502
|
+
data = Extractors_1.extractors[resource](response);
|
|
503
|
+
return [2 /*return*/, data];
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* Get the tweet timeline of a user.
|
|
510
|
+
*
|
|
511
|
+
* @param id - The id of the target user.
|
|
512
|
+
* @param count - The number of timeline items to fetch, must be \<= 20.
|
|
513
|
+
* @param cursor - The cursor to the batch of timeline items to fetch.
|
|
514
|
+
*
|
|
515
|
+
* @returns The timeline of the target user.
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```
|
|
519
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
520
|
+
*
|
|
521
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
522
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
523
|
+
*
|
|
524
|
+
* // Fetching the first 20 timeline tweets of the User with id '1234567890'
|
|
525
|
+
* rettiwt.user.timeline('1234567890')
|
|
526
|
+
* .then(res => {
|
|
527
|
+
* console.log(res);
|
|
528
|
+
* })
|
|
529
|
+
* .catch(err => {
|
|
530
|
+
* console.log(err);
|
|
531
|
+
* });
|
|
532
|
+
* ```
|
|
533
|
+
*
|
|
534
|
+
* @remarks
|
|
535
|
+
* - If the target user has a pinned tweet, the returned timeline has one item extra and this is always the pinned tweet.
|
|
536
|
+
* - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
|
|
537
|
+
*/
|
|
538
|
+
UserService.prototype.timeline = function (id, count, cursor) {
|
|
539
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
540
|
+
var resource, response, data;
|
|
541
|
+
return __generator(this, function (_a) {
|
|
542
|
+
switch (_a.label) {
|
|
543
|
+
case 0:
|
|
544
|
+
resource = Resource_1.EResourceType.USER_TIMELINE;
|
|
545
|
+
return [4 /*yield*/, this.request(resource, {
|
|
546
|
+
id: id,
|
|
547
|
+
count: count,
|
|
548
|
+
cursor: cursor,
|
|
549
|
+
})];
|
|
550
|
+
case 1:
|
|
551
|
+
response = _a.sent();
|
|
552
|
+
data = Extractors_1.extractors[resource](response);
|
|
553
|
+
return [2 /*return*/, data];
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* Unfollow a user.
|
|
560
|
+
*
|
|
561
|
+
* @param id - The id the user to be unfollowed.
|
|
562
|
+
*
|
|
563
|
+
* @returns Whether unfollowing was successful or not.
|
|
564
|
+
*
|
|
565
|
+
* @throws Code 34 if given user id is invalid.
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```
|
|
569
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
570
|
+
*
|
|
571
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
572
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
573
|
+
*
|
|
574
|
+
* // Unfollowing the User with id '12345678'
|
|
575
|
+
* rettiwt.user.unfollow('12345678')
|
|
576
|
+
* .then(res => {
|
|
577
|
+
* console.log(res);
|
|
578
|
+
* })
|
|
579
|
+
* .catch(err => {
|
|
580
|
+
* console.log(err);
|
|
581
|
+
* });
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
UserService.prototype.unfollow = function (id) {
|
|
585
|
+
var _a;
|
|
586
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
587
|
+
var resource, response, data;
|
|
588
|
+
return __generator(this, function (_b) {
|
|
589
|
+
switch (_b.label) {
|
|
590
|
+
case 0:
|
|
591
|
+
resource = Resource_1.EResourceType.USER_UNFOLLOW;
|
|
592
|
+
return [4 /*yield*/, this.request(Resource_1.EResourceType.USER_UNFOLLOW, { id: id })];
|
|
357
593
|
case 1:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
data.list = data.list.filter(function (tweet) { return tweet.tweetBy.id == userId; });
|
|
594
|
+
response = _b.sent();
|
|
595
|
+
data = (_a = Extractors_1.extractors[resource](response)) !== null && _a !== void 0 ? _a : false;
|
|
361
596
|
return [2 /*return*/, data];
|
|
362
597
|
}
|
|
363
598
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,2DAA0D;AAC1D,iDAAqD;AAMrD,mDAAkD;AAElD;;;;GAIG;AACH;IAAiC,+BAAc;IAC9C;;;;OAIG;IACH,qBAAmB,M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-0,0 +1,21 @@
|
|
|
1
|
+
import { CursoredData } from '../models/data/CursoredData';
|
|
2
|
+
import { Tweet } from '../models/data/Tweet';
|
|
3
|
+
import { User } from '../models/data/User';
|
|
4
|
+
/**
|
|
5
|
+
* Collection of all return types.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export type AllReturnTypes = boolean | CursoredData<Tweet> | CursoredData<User> | string | Tweet | User;
|
|
10
|
+
/**
|
|
11
|
+
* Return type of fetch requests.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export type FetchReturnType = boolean | CursoredData<Tweet> | CursoredData<User> | Tweet | User;
|
|
16
|
+
/**
|
|
17
|
+
* Return type of post requests.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export type PostReturnType = boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReturnTypes.js","sourceRoot":"","sources":["../../src/types/ReturnTypes.ts"],"names":[],"mappings":""}
|