rettiwt-api 5.0.1 → 6.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/.eslintrc.js +13 -8
- package/README.md +8 -1
- package/dist/cli.js +17 -14
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +1 -1
- package/dist/collections/Extractors.js +21 -21
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.d.ts +4 -4
- package/dist/collections/Groups.js +45 -45
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.d.ts +3 -3
- package/dist/collections/Requests.js +3 -3
- package/dist/collections/Requests.js.map +1 -1
- package/dist/collections/Tweet.d.ts +4 -4
- package/dist/collections/Tweet.js +5 -5
- package/dist/collections/Tweet.js.map +1 -1
- package/dist/commands/Tweet.js +48 -12
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/enums/Api.d.ts +1 -1
- package/dist/enums/Api.js +7 -7
- package/dist/enums/Api.js.map +1 -1
- package/dist/enums/Authentication.d.ts +1 -1
- package/dist/enums/Authentication.js +7 -7
- package/dist/enums/Authentication.js.map +1 -1
- package/dist/enums/Data.d.ts +1 -1
- package/dist/enums/Data.js +7 -7
- package/dist/enums/Data.js.map +1 -1
- package/dist/enums/Logging.d.ts +1 -1
- package/dist/enums/Logging.js +11 -11
- package/dist/enums/Logging.js.map +1 -1
- package/dist/enums/Media.d.ts +1 -1
- package/dist/enums/Media.js +7 -7
- package/dist/enums/Media.js.map +1 -1
- package/dist/enums/Notification.d.ts +1 -1
- package/dist/enums/Notification.js +9 -9
- package/dist/enums/Notification.js.map +1 -1
- package/dist/enums/Resource.d.ts +1 -1
- package/dist/enums/Resource.js +42 -42
- package/dist/enums/Resource.js.map +1 -1
- package/dist/enums/Tweet.d.ts +1 -1
- package/dist/enums/Tweet.js +7 -7
- package/dist/enums/Tweet.js.map +1 -1
- package/dist/enums/raw/Analytics.d.ts +2 -2
- package/dist/enums/raw/Analytics.js +21 -21
- package/dist/enums/raw/Analytics.js.map +1 -1
- package/dist/enums/raw/Media.d.ts +1 -1
- package/dist/enums/raw/Media.js +7 -7
- package/dist/enums/raw/Media.js.map +1 -1
- package/dist/enums/raw/Notification.d.ts +1 -1
- package/dist/enums/raw/Notification.js +8 -8
- package/dist/enums/raw/Notification.js.map +1 -1
- package/dist/enums/raw/Tweet.d.ts +2 -2
- package/dist/enums/raw/Tweet.js +12 -12
- package/dist/enums/raw/Tweet.js.map +1 -1
- package/dist/models/RettiwtConfig.d.ts +3 -2
- package/dist/models/RettiwtConfig.js +7 -5
- package/dist/models/RettiwtConfig.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +7 -5
- package/dist/models/args/FetchArgs.js +15 -9
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/auth/AuthCredential.d.ts +2 -2
- package/dist/models/auth/AuthCredential.js +3 -3
- package/dist/models/auth/AuthCredential.js.map +1 -1
- package/dist/models/data/CursoredData.d.ts +2 -2
- package/dist/models/data/CursoredData.js +3 -3
- package/dist/models/data/CursoredData.js.map +1 -1
- package/dist/models/data/Notification.d.ts +2 -2
- package/dist/models/data/Notification.js +3 -3
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +4 -4
- package/dist/models/data/Tweet.js +18 -18
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.js +9 -9
- package/dist/models/data/User.js.map +1 -1
- package/dist/requests/Tweet.d.ts +2 -2
- package/dist/requests/Tweet.js +2 -2
- package/dist/requests/Tweet.js.map +1 -1
- package/dist/requests/User.d.ts +2 -2
- package/dist/requests/User.js.map +1 -1
- package/dist/services/internal/AuthService.js +1 -1
- package/dist/services/internal/AuthService.js.map +1 -1
- package/dist/services/internal/ErrorService.d.ts +2 -2
- package/dist/services/internal/ErrorService.js +4 -4
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/LogService.d.ts +2 -2
- package/dist/services/internal/LogService.js.map +1 -1
- package/dist/services/internal/TidService.d.ts +4 -4
- package/dist/services/internal/TidService.js +10 -10
- package/dist/services/internal/TidService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +7 -7
- package/dist/services/public/FetcherService.js +79 -35
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.js +4 -4
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +3 -3
- package/dist/services/public/TweetService.js +35 -35
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.js +37 -37
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/RettiwtConfig.d.ts +6 -0
- package/dist/types/args/FetchArgs.d.ts +14 -6
- package/dist/types/auth/AuthCredential.d.ts +2 -2
- package/dist/types/data/Notification.d.ts +2 -2
- package/dist/types/data/Tweet.d.ts +2 -2
- package/dist/types/raw/base/Media.d.ts +2 -2
- package/dist/types/raw/base/Notification.d.ts +2 -2
- package/package.json +18 -18
- package/src/cli.ts +20 -14
- package/src/collections/Extractors.ts +21 -21
- package/src/collections/Groups.ts +45 -45
- package/src/collections/Requests.ts +4 -4
- package/src/collections/Tweet.ts +6 -6
- package/src/commands/Tweet.ts +49 -12
- package/src/enums/Api.ts +1 -1
- package/src/enums/Authentication.ts +1 -1
- package/src/enums/Data.ts +1 -1
- package/src/enums/Logging.ts +1 -1
- package/src/enums/Media.ts +1 -1
- package/src/enums/Notification.ts +1 -1
- package/src/enums/Resource.ts +1 -1
- package/src/enums/Tweet.ts +1 -1
- package/src/enums/raw/Analytics.ts +2 -2
- package/src/enums/raw/Media.ts +1 -1
- package/src/enums/raw/Notification.ts +1 -1
- package/src/enums/raw/Tweet.ts +2 -2
- package/src/models/RettiwtConfig.ts +7 -5
- package/src/models/args/FetchArgs.ts +17 -11
- package/src/models/auth/AuthCredential.ts +5 -5
- package/src/models/data/CursoredData.ts +5 -5
- package/src/models/data/Notification.ts +6 -6
- package/src/models/data/Tweet.ts +22 -22
- package/src/models/data/User.ts +10 -10
- package/src/requests/Tweet.ts +4 -4
- package/src/requests/User.ts +3 -3
- package/src/services/internal/AuthService.ts +2 -2
- package/src/services/internal/ErrorService.ts +4 -4
- package/src/services/internal/LogService.ts +2 -2
- package/src/services/internal/TidService.ts +11 -11
- package/src/services/public/FetcherService.ts +54 -38
- package/src/services/public/ListService.ts +6 -6
- package/src/services/public/TweetService.ts +39 -39
- package/src/services/public/UserService.ts +40 -40
- package/src/types/RettiwtConfig.ts +7 -0
- package/src/types/args/FetchArgs.ts +18 -8
- package/src/types/auth/AuthCredential.ts +2 -2
- package/src/types/data/Notification.ts +2 -2
- package/src/types/data/Tweet.ts +2 -2
- package/src/types/raw/base/Media.ts +2 -2
- package/src/types/raw/base/Notification.ts +2 -2
- package/.tool-versions +0 -1
|
@@ -46,7 +46,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
async affiliates(id, count, cursor) {
|
|
49
|
-
const resource = Resource_1.
|
|
49
|
+
const resource = Resource_1.ResourceType.USER_AFFILIATES;
|
|
50
50
|
// Fetching raw list of affiliates
|
|
51
51
|
const response = await this.request(resource, {
|
|
52
52
|
id: id ?? this.config.userId,
|
|
@@ -54,7 +54,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
54
54
|
cursor: cursor,
|
|
55
55
|
});
|
|
56
56
|
// Deserializing response
|
|
57
|
-
const data = Extractors_1.
|
|
57
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
58
58
|
return data;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
@@ -84,14 +84,14 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
86
|
async bookmarks(count, cursor) {
|
|
87
|
-
const resource = Resource_1.
|
|
87
|
+
const resource = Resource_1.ResourceType.USER_BOOKMARKS;
|
|
88
88
|
// Fetching raw list of likes
|
|
89
89
|
const response = await this.request(resource, {
|
|
90
90
|
count: count,
|
|
91
91
|
cursor: cursor,
|
|
92
92
|
});
|
|
93
93
|
// Deserializing response
|
|
94
|
-
const data = Extractors_1.
|
|
94
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
95
95
|
return data;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
@@ -166,22 +166,22 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
166
166
|
let resource;
|
|
167
167
|
// If details of multiple users required
|
|
168
168
|
if (Array.isArray(id)) {
|
|
169
|
-
resource = Resource_1.
|
|
169
|
+
resource = Resource_1.ResourceType.USER_DETAILS_BY_IDS_BULK;
|
|
170
170
|
// Fetching raw details
|
|
171
171
|
const response = await this.request(resource, { ids: id });
|
|
172
172
|
// Deserializing response
|
|
173
|
-
const data = Extractors_1.
|
|
173
|
+
const data = Extractors_1.Extractors[resource](response, id);
|
|
174
174
|
return data;
|
|
175
175
|
}
|
|
176
176
|
// If details of single user required
|
|
177
177
|
else {
|
|
178
178
|
// If username is given
|
|
179
179
|
if (id && isNaN(Number(id))) {
|
|
180
|
-
resource = Resource_1.
|
|
180
|
+
resource = Resource_1.ResourceType.USER_DETAILS_BY_USERNAME;
|
|
181
181
|
}
|
|
182
182
|
// If id is given (or not, for self details)
|
|
183
183
|
else {
|
|
184
|
-
resource = Resource_1.
|
|
184
|
+
resource = Resource_1.ResourceType.USER_DETAILS_BY_ID;
|
|
185
185
|
}
|
|
186
186
|
// If no ID is given, and not authenticated, skip
|
|
187
187
|
if (!id && !this.config.userId) {
|
|
@@ -190,7 +190,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
190
190
|
// Fetching raw details
|
|
191
191
|
const response = await this.request(resource, { id: id ?? this.config.userId });
|
|
192
192
|
// Deserializing response
|
|
193
|
-
const data = Extractors_1.
|
|
193
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
194
194
|
return data;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -222,11 +222,11 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
222
222
|
* ```
|
|
223
223
|
*/
|
|
224
224
|
async follow(id) {
|
|
225
|
-
const resource = Resource_1.
|
|
225
|
+
const resource = Resource_1.ResourceType.USER_FOLLOW;
|
|
226
226
|
// Following the user
|
|
227
|
-
const response = await this.request(Resource_1.
|
|
227
|
+
const response = await this.request(Resource_1.ResourceType.USER_FOLLOW, { id: id });
|
|
228
228
|
// Deserializing the response
|
|
229
|
-
const data = Extractors_1.
|
|
229
|
+
const data = Extractors_1.Extractors[resource](response) ?? false;
|
|
230
230
|
return data;
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
@@ -257,13 +257,13 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
257
257
|
* @remarks Always returns 35 feed items, with no way to customize the count.
|
|
258
258
|
*/
|
|
259
259
|
async followed(cursor) {
|
|
260
|
-
const resource = Resource_1.
|
|
260
|
+
const resource = Resource_1.ResourceType.USER_FEED_FOLLOWED;
|
|
261
261
|
// Fetching raw list of tweets
|
|
262
262
|
const response = await this.request(resource, {
|
|
263
263
|
cursor: cursor,
|
|
264
264
|
});
|
|
265
265
|
// Deserializing response
|
|
266
|
-
const data = Extractors_1.
|
|
266
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
267
267
|
return data;
|
|
268
268
|
}
|
|
269
269
|
/**
|
|
@@ -294,7 +294,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
294
294
|
* ```
|
|
295
295
|
*/
|
|
296
296
|
async followers(id, count, cursor) {
|
|
297
|
-
const resource = Resource_1.
|
|
297
|
+
const resource = Resource_1.ResourceType.USER_FOLLOWERS;
|
|
298
298
|
// Fetching raw list of followers
|
|
299
299
|
const response = await this.request(resource, {
|
|
300
300
|
id: id ?? this.config.userId,
|
|
@@ -302,7 +302,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
302
302
|
cursor: cursor,
|
|
303
303
|
});
|
|
304
304
|
// Deserializing response
|
|
305
|
-
const data = Extractors_1.
|
|
305
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
306
306
|
return data;
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
@@ -333,7 +333,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
333
333
|
* ```
|
|
334
334
|
*/
|
|
335
335
|
async following(id, count, cursor) {
|
|
336
|
-
const resource = Resource_1.
|
|
336
|
+
const resource = Resource_1.ResourceType.USER_FOLLOWING;
|
|
337
337
|
// Fetching raw list of following
|
|
338
338
|
const response = await this.request(resource, {
|
|
339
339
|
id: id ?? this.config.userId,
|
|
@@ -341,7 +341,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
341
341
|
cursor: cursor,
|
|
342
342
|
});
|
|
343
343
|
// Deserializing response
|
|
344
|
-
const data = Extractors_1.
|
|
344
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
345
345
|
return data;
|
|
346
346
|
}
|
|
347
347
|
/**
|
|
@@ -372,7 +372,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
372
372
|
* ```
|
|
373
373
|
*/
|
|
374
374
|
async highlights(id, count, cursor) {
|
|
375
|
-
const resource = Resource_1.
|
|
375
|
+
const resource = Resource_1.ResourceType.USER_HIGHLIGHTS;
|
|
376
376
|
// Fetching raw list of highlights
|
|
377
377
|
const response = await this.request(resource, {
|
|
378
378
|
id: id ?? this.config.userId,
|
|
@@ -380,7 +380,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
380
380
|
cursor: cursor,
|
|
381
381
|
});
|
|
382
382
|
// Deserializing response
|
|
383
|
-
const data = Extractors_1.
|
|
383
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
384
384
|
return data;
|
|
385
385
|
}
|
|
386
386
|
/**
|
|
@@ -410,7 +410,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
410
410
|
* ```
|
|
411
411
|
*/
|
|
412
412
|
async likes(count, cursor) {
|
|
413
|
-
const resource = Resource_1.
|
|
413
|
+
const resource = Resource_1.ResourceType.USER_LIKES;
|
|
414
414
|
// Fetching raw list of likes
|
|
415
415
|
const response = await this.request(resource, {
|
|
416
416
|
id: this.config.userId,
|
|
@@ -418,7 +418,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
418
418
|
cursor: cursor,
|
|
419
419
|
});
|
|
420
420
|
// Deserializing response
|
|
421
|
-
const data = Extractors_1.
|
|
421
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
422
422
|
return data;
|
|
423
423
|
}
|
|
424
424
|
/**
|
|
@@ -449,7 +449,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
449
449
|
* ```
|
|
450
450
|
*/
|
|
451
451
|
async media(id, count, cursor) {
|
|
452
|
-
const resource = Resource_1.
|
|
452
|
+
const resource = Resource_1.ResourceType.USER_MEDIA;
|
|
453
453
|
// Fetching raw list of media
|
|
454
454
|
const response = await this.request(resource, {
|
|
455
455
|
id: id ?? this.config.userId,
|
|
@@ -457,7 +457,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
457
457
|
cursor: cursor,
|
|
458
458
|
});
|
|
459
459
|
// Deserializing response
|
|
460
|
-
const data = Extractors_1.
|
|
460
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
461
461
|
return data;
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
@@ -493,7 +493,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
493
493
|
* ```
|
|
494
494
|
*/
|
|
495
495
|
async *notifications(pollingInterval = 60000) {
|
|
496
|
-
const resource = Resource_1.
|
|
496
|
+
const resource = Resource_1.ResourceType.USER_NOTIFICATIONS;
|
|
497
497
|
/** Whether it's the first batch of notifications or not. */
|
|
498
498
|
let first = true;
|
|
499
499
|
/** The cursor to the last notification received. */
|
|
@@ -507,7 +507,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
507
507
|
cursor: cursor,
|
|
508
508
|
});
|
|
509
509
|
// Deserializing response
|
|
510
|
-
const notifications = Extractors_1.
|
|
510
|
+
const notifications = Extractors_1.Extractors[resource](response);
|
|
511
511
|
// Sorting the notifications by time, from oldest to recent
|
|
512
512
|
notifications.list.sort((a, b) => new Date(a.receivedAt).valueOf() - new Date(b.receivedAt).valueOf());
|
|
513
513
|
// If not first batch, return new notifications
|
|
@@ -552,13 +552,13 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
552
552
|
* @remarks Always returns 35 feed items, with no way to customize the count.
|
|
553
553
|
*/
|
|
554
554
|
async recommended(cursor) {
|
|
555
|
-
const resource = Resource_1.
|
|
555
|
+
const resource = Resource_1.ResourceType.USER_FEED_RECOMMENDED;
|
|
556
556
|
// Fetching raw list of tweets
|
|
557
557
|
const response = await this.request(resource, {
|
|
558
558
|
cursor: cursor,
|
|
559
559
|
});
|
|
560
560
|
// Deserializing response
|
|
561
|
-
const data = Extractors_1.
|
|
561
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
562
562
|
return data;
|
|
563
563
|
}
|
|
564
564
|
/**
|
|
@@ -593,7 +593,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
593
593
|
* If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
|
|
594
594
|
*/
|
|
595
595
|
async replies(id, count, cursor) {
|
|
596
|
-
const resource = Resource_1.
|
|
596
|
+
const resource = Resource_1.ResourceType.USER_TIMELINE_AND_REPLIES;
|
|
597
597
|
// Fetching raw list of replies
|
|
598
598
|
const response = await this.request(resource, {
|
|
599
599
|
id: id ?? this.config.userId,
|
|
@@ -601,7 +601,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
601
601
|
cursor: cursor,
|
|
602
602
|
});
|
|
603
603
|
// Deserializing response
|
|
604
|
-
const data = Extractors_1.
|
|
604
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
605
605
|
return data;
|
|
606
606
|
}
|
|
607
607
|
/**
|
|
@@ -634,7 +634,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
634
634
|
* ```
|
|
635
635
|
*/
|
|
636
636
|
async subscriptions(id, count, cursor) {
|
|
637
|
-
const resource = Resource_1.
|
|
637
|
+
const resource = Resource_1.ResourceType.USER_SUBSCRIPTIONS;
|
|
638
638
|
// Fetching raw list of subscriptions
|
|
639
639
|
const response = await this.request(resource, {
|
|
640
640
|
id: id ?? this.config.userId,
|
|
@@ -642,7 +642,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
642
642
|
cursor: cursor,
|
|
643
643
|
});
|
|
644
644
|
// Deserializing response
|
|
645
|
-
const data = Extractors_1.
|
|
645
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
646
646
|
return data;
|
|
647
647
|
}
|
|
648
648
|
/**
|
|
@@ -678,7 +678,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
678
678
|
* - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
|
|
679
679
|
*/
|
|
680
680
|
async timeline(id, count, cursor) {
|
|
681
|
-
const resource = Resource_1.
|
|
681
|
+
const resource = Resource_1.ResourceType.USER_TIMELINE;
|
|
682
682
|
// Fetching raw list of tweets
|
|
683
683
|
const response = await this.request(resource, {
|
|
684
684
|
id: id ?? this.config.userId,
|
|
@@ -686,7 +686,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
686
686
|
cursor: cursor,
|
|
687
687
|
});
|
|
688
688
|
// Deserializing response
|
|
689
|
-
const data = Extractors_1.
|
|
689
|
+
const data = Extractors_1.Extractors[resource](response);
|
|
690
690
|
return data;
|
|
691
691
|
}
|
|
692
692
|
/**
|
|
@@ -715,11 +715,11 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
715
715
|
* ```
|
|
716
716
|
*/
|
|
717
717
|
async unfollow(id) {
|
|
718
|
-
const resource = Resource_1.
|
|
718
|
+
const resource = Resource_1.ResourceType.USER_UNFOLLOW;
|
|
719
719
|
// Unfollowing the user
|
|
720
|
-
const response = await this.request(Resource_1.
|
|
720
|
+
const response = await this.request(Resource_1.ResourceType.USER_UNFOLLOW, { id: id });
|
|
721
721
|
// Deserializing the response
|
|
722
|
-
const data = Extractors_1.
|
|
722
|
+
const data = Extractors_1.Extractors[resource](response) ?? false;
|
|
723
723
|
return data;
|
|
724
724
|
}
|
|
725
725
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAC1D,mDAAoD;AAwBpD,qDAAkD;AAElD;;;;GAIG;AACH,MAAa,WAAY,SAAQ,+BAAc;IAC9C;;;;OAIG;IACH,YAAmB,MAAqB;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACI,KAAK,CAAC,UAAU,CAAC,EAAW,EAAE,KAAc,EAAE,MAAe;QACnE,MAAM,QAAQ,GAAG,uBAAY,CAAC,eAAe,CAAC;QAE9C,kCAAkC;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAA0B,QAAQ,EAAE;YACtE,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM;YAC5B,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;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,KAAK,CAAC,SAAS,CAAC,KAAc,EAAE,MAAe;QACrD,MAAM,QAAQ,GAAG,uBAAY,CAAC,cAAc,CAAC;QAE7C,6BAA6B;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAyB,QAAQ,EAAE;YACrE,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;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,IAAI,CAAC,OAAO,CAAsB,QAAQ,EAAE;YAClE,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM;YAC5B,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;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACI,KAAK,CAAC,QAAQ,CAAC,EAAU;QAC/B,MAAM,QAAQ,GAAG,uBAAY,CAAC,aAAa,CAAC;QAE5C,uBAAuB;QACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAwB,uBAAY,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAEnG,6BAA6B;QAC7B,MAAM,IAAI,GAAG,uBAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;QAErD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AArxBD,kCAqxBC"}
|
|
@@ -36,4 +36,10 @@ export interface IRettiwtConfig {
|
|
|
36
36
|
* Can either be a number or a function that returns a number synchronously or asynchronously.
|
|
37
37
|
*/
|
|
38
38
|
delay?: number | (() => number | Promise<number>);
|
|
39
|
+
/**
|
|
40
|
+
* The maximum number of retries to use.
|
|
41
|
+
*
|
|
42
|
+
* @remarks Recommended to use a value of 5 combined with a `delay` of 1000 to prevent error 404.
|
|
43
|
+
*/
|
|
44
|
+
maxRetries?: number;
|
|
39
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TweetRepliesSortType } from '../../enums/Tweet';
|
|
2
2
|
/**
|
|
3
3
|
* Options specifying the data that is to be fetched.
|
|
4
4
|
*
|
|
@@ -58,7 +58,7 @@ export interface IFetchArgs {
|
|
|
58
58
|
* @remarks
|
|
59
59
|
* - Only works for {@link EResourceType.TWEET_REPLIES}.
|
|
60
60
|
*/
|
|
61
|
-
sortBy?:
|
|
61
|
+
sortBy?: TweetRepliesSortType;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* The filter to be used for searching tweets.
|
|
@@ -90,8 +90,6 @@ export interface ITweetFilter {
|
|
|
90
90
|
includeWords?: string[];
|
|
91
91
|
/** The language of the tweets to search. */
|
|
92
92
|
language?: string;
|
|
93
|
-
/** Whether to fetch tweets that are links or not. */
|
|
94
|
-
links?: boolean;
|
|
95
93
|
/** The list from which tweets are to be searched. */
|
|
96
94
|
list?: string;
|
|
97
95
|
/** The id of the tweet, before which the tweets are to be searched. */
|
|
@@ -109,12 +107,22 @@ export interface ITweetFilter {
|
|
|
109
107
|
minReplies?: number;
|
|
110
108
|
/** The minimum number of retweets to search by. */
|
|
111
109
|
minRetweets?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Whether to search only posts that contain links.
|
|
112
|
+
*
|
|
113
|
+
* @remarks 'links' includes things like media, quotes, retweets, etc.
|
|
114
|
+
*/
|
|
115
|
+
onlyLinks?: boolean;
|
|
116
|
+
/** Whether to search only original posts. */
|
|
117
|
+
onlyOriginal?: boolean;
|
|
118
|
+
/** Whether to search only replies */
|
|
119
|
+
onlyReplies?: boolean;
|
|
120
|
+
/** Whether to search posts that only contain text. */
|
|
121
|
+
onlyText?: boolean;
|
|
112
122
|
/** The optional words to search. */
|
|
113
123
|
optionalWords?: string[];
|
|
114
124
|
/** The id of the tweet which is quoted in the tweets to search. */
|
|
115
125
|
quoted?: string;
|
|
116
|
-
/** Whether to fetch tweets that are replies or not. */
|
|
117
|
-
replies?: boolean;
|
|
118
126
|
/** The id of the tweet, after which the tweets are to be searched. */
|
|
119
127
|
sinceId?: string;
|
|
120
128
|
/** The date starting from which tweets are to be searched. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthenticationType } from '../../enums/Authentication';
|
|
2
2
|
/**
|
|
3
3
|
* The credentials for authenticating against Twitter.
|
|
4
4
|
*
|
|
@@ -13,7 +13,7 @@ export interface IAuthCredential {
|
|
|
13
13
|
/** The bearer token from twitter.com. */
|
|
14
14
|
authToken?: string;
|
|
15
15
|
/** The type of authentication. */
|
|
16
|
-
authenticationType?:
|
|
16
|
+
authenticationType?: AuthenticationType;
|
|
17
17
|
/** The cookie of the twitter account, which is used to authenticate against twitter. */
|
|
18
18
|
cookies?: string;
|
|
19
19
|
/** The CSRF token for the session. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NotificationType } from '../../enums/Notification';
|
|
2
2
|
/**
|
|
3
3
|
* The details of a single notification.
|
|
4
4
|
*
|
|
@@ -16,5 +16,5 @@ export interface INotification {
|
|
|
16
16
|
/** The list of id of the target tweet(s) of the notification. */
|
|
17
17
|
target: string[];
|
|
18
18
|
/** The type of notification. */
|
|
19
|
-
type?:
|
|
19
|
+
type?: NotificationType;
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MediaType } from '../../enums/Media';
|
|
2
2
|
import { IUser } from './User';
|
|
3
3
|
/**
|
|
4
4
|
* The details of a single tweet.
|
|
@@ -65,7 +65,7 @@ export interface ITweetMedia {
|
|
|
65
65
|
/** The thumbnail URL for the video content of the tweet. */
|
|
66
66
|
thumbnailUrl?: string;
|
|
67
67
|
/** The type of media. */
|
|
68
|
-
type:
|
|
68
|
+
type: MediaType;
|
|
69
69
|
/** The direct URL to the media. */
|
|
70
70
|
url: string;
|
|
71
71
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RawMediaType } from '../../../enums/raw/Media';
|
|
2
2
|
/**
|
|
3
3
|
* Represents the raw data of a single Media.
|
|
4
4
|
*
|
|
@@ -9,7 +9,7 @@ export interface IMedia {
|
|
|
9
9
|
expanded_url: string;
|
|
10
10
|
id_str: string;
|
|
11
11
|
media_url_https: string;
|
|
12
|
-
type:
|
|
12
|
+
type: RawMediaType;
|
|
13
13
|
url: string;
|
|
14
14
|
}
|
|
15
15
|
export interface IExtendedMedia extends IMedia {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RawNotificationType } from '../../../enums/raw/Notification';
|
|
2
2
|
/**
|
|
3
3
|
* Represents the raw data of a single Notification.
|
|
4
4
|
*
|
|
@@ -12,7 +12,7 @@ export interface INotification {
|
|
|
12
12
|
template: INotificationTemplate;
|
|
13
13
|
}
|
|
14
14
|
export interface INotificationIcon {
|
|
15
|
-
id:
|
|
15
|
+
id: RawNotificationType;
|
|
16
16
|
}
|
|
17
17
|
export interface INotificationMessage {
|
|
18
18
|
text: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rettiwt-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"description": "An API for fetching data from TwitterAPI, without any rate limits!",
|
|
@@ -32,24 +32,24 @@
|
|
|
32
32
|
"node": "^22.13.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/cookiejar": "2.1.5",
|
|
36
|
-
"@types/node": "22.13.1",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "8.24.0",
|
|
38
|
-
"@typescript-eslint/parser": "8.24.0",
|
|
39
|
-
"eslint": "9.20.1",
|
|
40
|
-
"eslint-plugin-import": "2.31.0",
|
|
41
|
-
"eslint-plugin-tsdoc": "0.4.0",
|
|
42
|
-
"nodemon": "3.1.9",
|
|
43
|
-
"prettier": "3.5.1",
|
|
44
|
-
"typedoc": "0.27.7",
|
|
45
|
-
"typescript": "5.7.3"
|
|
35
|
+
"@types/cookiejar": "^2.1.5",
|
|
36
|
+
"@types/node": "^22.13.1",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
38
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
39
|
+
"eslint": "^9.20.1",
|
|
40
|
+
"eslint-plugin-import": "^2.31.0",
|
|
41
|
+
"eslint-plugin-tsdoc": "^0.4.0",
|
|
42
|
+
"nodemon": "^3.1.9",
|
|
43
|
+
"prettier": "^3.5.1",
|
|
44
|
+
"typedoc": "^0.27.7",
|
|
45
|
+
"typescript": "^5.7.3"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"axios": "1.8.4",
|
|
49
|
-
"chalk": "5.4.1",
|
|
50
|
-
"commander": "11.1.0",
|
|
51
|
-
"cookiejar": "2.1.4",
|
|
52
|
-
"https-proxy-agent": "7.0.6",
|
|
53
|
-
"node-html-parser": "7.0.1"
|
|
48
|
+
"axios": "^1.8.4",
|
|
49
|
+
"chalk": "^5.4.1",
|
|
50
|
+
"commander": "^11.1.0",
|
|
51
|
+
"cookiejar": "^2.1.4",
|
|
52
|
+
"https-proxy-agent": "^7.0.6",
|
|
53
|
+
"node-html-parser": "^7.0.1"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/cli.ts
CHANGED
|
@@ -8,33 +8,39 @@ import user from './commands/User';
|
|
|
8
8
|
import { Rettiwt } from './Rettiwt';
|
|
9
9
|
|
|
10
10
|
// Creating a new commandline program
|
|
11
|
-
const
|
|
11
|
+
const Program = createCommand('rettiwt')
|
|
12
12
|
.description('A CLI tool for accessing the Twitter API for free!')
|
|
13
13
|
.passThroughOptions()
|
|
14
14
|
.enablePositionalOptions();
|
|
15
15
|
|
|
16
16
|
// Adding options
|
|
17
|
-
|
|
18
|
-
.option('-k, --key <string>', 'The API key to use for authentication')
|
|
17
|
+
Program.option('-k, --key <string>', 'The API key to use for authentication')
|
|
19
18
|
.option('-l, --log', 'Enable logging to console')
|
|
20
19
|
.option('-p, --proxy <string>', 'The URL to the proxy to use')
|
|
21
|
-
.option('-t, --timeout <number>', 'The timout (in milli-seconds) to use for requests')
|
|
20
|
+
.option('-t, --timeout <number>', 'The timout (in milli-seconds) to use for requests')
|
|
21
|
+
.option(
|
|
22
|
+
'-r, --retries <number>',
|
|
23
|
+
'The maximum number of retries to use, a value of 5 combined with a delay of 1000 is recommended',
|
|
24
|
+
)
|
|
25
|
+
.option('-d, --delay <number>', 'The delay in milliseconds to use in-between successive requests');
|
|
22
26
|
|
|
23
27
|
// Parsing the program to get supplied options
|
|
24
|
-
|
|
28
|
+
Program.parse();
|
|
25
29
|
|
|
26
30
|
// Initializing Rettiwt instance using the given options
|
|
27
|
-
const
|
|
28
|
-
apiKey: process.env.API_KEY ?? (
|
|
29
|
-
logging:
|
|
30
|
-
proxyUrl:
|
|
31
|
-
timeout:
|
|
31
|
+
const RettiwtInstance = new Rettiwt({
|
|
32
|
+
apiKey: process.env.API_KEY ?? (Program.opts().key as string),
|
|
33
|
+
logging: Program.opts().log ? true : false,
|
|
34
|
+
proxyUrl: Program.opts().proxy as URL,
|
|
35
|
+
timeout: Program.opts().timeout ? Number(Program.opts().timeout) : undefined,
|
|
36
|
+
maxRetries: Program.opts().retries as number,
|
|
37
|
+
delay: Program.opts().delay as number,
|
|
32
38
|
});
|
|
33
39
|
|
|
34
40
|
// Adding sub-commands
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
Program.addCommand(list(RettiwtInstance));
|
|
42
|
+
Program.addCommand(tweet(RettiwtInstance));
|
|
43
|
+
Program.addCommand(user(RettiwtInstance));
|
|
38
44
|
|
|
39
45
|
// Finalizing the CLI
|
|
40
|
-
|
|
46
|
+
Program.parse();
|