rettiwt-api 5.0.0-alpha.4 → 5.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/.github/workflows/documentation.yml +3 -3
- package/README.md +160 -87
- package/dist/collections/Requests.d.ts +1 -1
- package/dist/collections/Requests.js +3 -2
- package/dist/collections/Requests.js.map +1 -1
- package/dist/collections/Tweet.d.ts +10 -0
- package/dist/collections/Tweet.js +17 -0
- package/dist/collections/Tweet.js.map +1 -0
- package/dist/commands/Tweet.js +0 -16
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +0 -15
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Tweet.d.ts +8 -0
- package/dist/enums/Tweet.js +13 -0
- package/dist/enums/Tweet.js.map +1 -0
- package/dist/enums/raw/Tweet.d.ts +11 -1
- package/dist/enums/raw/Tweet.js +13 -2
- package/dist/enums/raw/Tweet.js.map +1 -1
- package/dist/helper/TidUtils.d.ts +2 -0
- package/dist/helper/TidUtils.js +10 -1
- package/dist/helper/TidUtils.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/models/RettiwtConfig.d.ts +27 -3
- package/dist/models/RettiwtConfig.js +37 -4
- package/dist/models/RettiwtConfig.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +3 -3
- package/dist/models/args/FetchArgs.js +3 -2
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/args/PostArgs.d.ts +2 -3
- package/dist/models/args/PostArgs.js +3 -3
- package/dist/models/args/PostArgs.js.map +1 -1
- package/dist/models/auth/AuthCookie.d.ts +1 -1
- package/dist/models/auth/AuthCookie.js +1 -1
- package/dist/models/auth/AuthCredential.d.ts +1 -1
- package/dist/models/auth/AuthCredential.js +1 -1
- package/dist/models/data/List.d.ts +1 -1
- package/dist/models/data/List.js +1 -1
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Notification.d.ts +1 -1
- package/dist/models/data/Notification.js +1 -1
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +1 -1
- package/dist/models/data/Tweet.js +1 -1
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +1 -1
- package/dist/models/data/User.js +1 -1
- package/dist/models/data/User.js.map +1 -1
- package/dist/requests/Tweet.d.ts +2 -1
- package/dist/requests/Tweet.js +3 -4
- package/dist/requests/Tweet.js.map +1 -1
- package/dist/services/internal/AuthService.d.ts +1 -1
- package/dist/services/internal/AuthService.js +1 -1
- package/dist/services/internal/TidService.d.ts +0 -1
- package/dist/services/internal/TidService.js +10 -15
- package/dist/services/internal/TidService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +4 -3
- package/dist/services/public/FetcherService.js +6 -5
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.d.ts +6 -4
- package/dist/services/public/ListService.js +6 -4
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +96 -74
- package/dist/services/public/TweetService.js +97 -87
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +80 -39
- package/dist/services/public/UserService.js +84 -43
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/args/FetchArgs.d.ts +8 -0
- package/package.json +1 -1
- package/src/collections/Requests.ts +5 -2
- package/src/collections/Tweet.ts +17 -0
- package/src/commands/Tweet.ts +0 -16
- package/src/commands/User.ts +0 -15
- package/src/enums/Tweet.ts +8 -0
- package/src/enums/raw/Tweet.ts +12 -1
- package/src/helper/TidUtils.ts +10 -1
- package/src/index.ts +1 -0
- package/src/models/RettiwtConfig.ts +43 -4
- package/src/models/args/FetchArgs.ts +4 -3
- package/src/models/args/PostArgs.ts +3 -4
- package/src/models/auth/AuthCookie.ts +1 -1
- package/src/models/auth/AuthCredential.ts +1 -1
- package/src/models/data/List.ts +1 -1
- package/src/models/data/Notification.ts +1 -1
- package/src/models/data/Tweet.ts +1 -1
- package/src/models/data/User.ts +1 -1
- package/src/requests/Tweet.ts +4 -5
- package/src/services/internal/AuthService.ts +1 -1
- package/src/services/internal/TidService.ts +12 -18
- package/src/services/public/FetcherService.ts +6 -5
- package/src/services/public/ListService.ts +6 -4
- package/src/services/public/TweetService.ts +101 -93
- package/src/services/public/UserService.ts +88 -47
- package/src/types/args/FetchArgs.ts +10 -0
|
@@ -43,14 +43,15 @@ export class UserService extends FetcherService {
|
|
|
43
43
|
/**
|
|
44
44
|
* Get the list affiliates of a user.
|
|
45
45
|
*
|
|
46
|
-
* @param id - The
|
|
46
|
+
* @param id - The ID of the target user. If no id is provided, the logged-in user's id is used.
|
|
47
47
|
* @param count - The number of affiliates to fetch, must be \<= 100.
|
|
48
48
|
* @param cursor - The cursor to the batch of affiliates to fetch.
|
|
49
49
|
*
|
|
50
50
|
* @returns The list of users affiliated to the target user.
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
|
-
*
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
54
55
|
* import { Rettiwt } from 'rettiwt-api';
|
|
55
56
|
*
|
|
56
57
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -71,7 +72,7 @@ export class UserService extends FetcherService {
|
|
|
71
72
|
|
|
72
73
|
// Fetching raw list of affiliates
|
|
73
74
|
const response = await this.request<IUserAffiliatesResponse>(resource, {
|
|
74
|
-
id: id,
|
|
75
|
+
id: id ?? this.config.userId,
|
|
75
76
|
count: count,
|
|
76
77
|
cursor: cursor,
|
|
77
78
|
});
|
|
@@ -91,7 +92,8 @@ export class UserService extends FetcherService {
|
|
|
91
92
|
* @returns The list of tweets bookmarked by the target user.
|
|
92
93
|
*
|
|
93
94
|
* @example
|
|
94
|
-
*
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
95
97
|
* import { Rettiwt } from 'rettiwt-api';
|
|
96
98
|
*
|
|
97
99
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -125,15 +127,19 @@ export class UserService extends FetcherService {
|
|
|
125
127
|
/**
|
|
126
128
|
* Get the details of a user.
|
|
127
129
|
*
|
|
128
|
-
* @param id - The username/
|
|
130
|
+
* @param id - The username/ID/IDs of the target user/users. If no ID is provided, the logged-in user's ID is used.
|
|
129
131
|
*
|
|
130
132
|
* @returns
|
|
131
133
|
* The details of the given user.
|
|
134
|
+
*
|
|
135
|
+
* If more than one ID is provided, returns a list.
|
|
136
|
+
*
|
|
132
137
|
* If no user matches the given id, returns `undefined`.
|
|
133
138
|
*
|
|
134
139
|
* @example
|
|
135
|
-
*
|
|
136
|
-
*
|
|
140
|
+
*
|
|
141
|
+
* #### Fetching the details of a single user using username
|
|
142
|
+
* ```ts
|
|
137
143
|
* import { Rettiwt } from 'rettiwt-api';
|
|
138
144
|
*
|
|
139
145
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -150,8 +156,9 @@ export class UserService extends FetcherService {
|
|
|
150
156
|
* ```
|
|
151
157
|
*
|
|
152
158
|
* @example
|
|
153
|
-
*
|
|
154
|
-
*
|
|
159
|
+
*
|
|
160
|
+
* #### Fetching the details of a single user using ID
|
|
161
|
+
* ```ts
|
|
155
162
|
* import { Rettiwt } from 'rettiwt-api';
|
|
156
163
|
*
|
|
157
164
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -160,7 +167,25 @@ export class UserService extends FetcherService {
|
|
|
160
167
|
* // Fetching the details of the User with id '1234567890'
|
|
161
168
|
* rettiwt.user.details('1234567890')
|
|
162
169
|
* .then(res => {
|
|
163
|
-
* console.log(res);
|
|
170
|
+
* console.log(res); # 'res' is a single tweet
|
|
171
|
+
* })
|
|
172
|
+
* .catch(err => {
|
|
173
|
+
* console.log(err);
|
|
174
|
+
* });
|
|
175
|
+
* ```
|
|
176
|
+
* * @example
|
|
177
|
+
*
|
|
178
|
+
* #### Fetching the details of multiple users
|
|
179
|
+
* ```ts
|
|
180
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
181
|
+
*
|
|
182
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
183
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
184
|
+
*
|
|
185
|
+
* // Fetching the details of the users with IDs '123', '456', '789'
|
|
186
|
+
* rettiwt.user.details(['123', '456', '789'])
|
|
187
|
+
* .then(res => {
|
|
188
|
+
* console.log(res); # 'res' is an array of users
|
|
164
189
|
* })
|
|
165
190
|
* .catch(err => {
|
|
166
191
|
* console.log(err);
|
|
@@ -213,14 +238,15 @@ export class UserService extends FetcherService {
|
|
|
213
238
|
/**
|
|
214
239
|
* Follow a user.
|
|
215
240
|
*
|
|
216
|
-
* @param id - The
|
|
241
|
+
* @param id - The ID the user to be followed.
|
|
217
242
|
*
|
|
218
243
|
* @returns Whether following was successful or not.
|
|
219
244
|
*
|
|
220
245
|
* @throws Code 108 if given user id is invalid.
|
|
221
246
|
*
|
|
222
247
|
* @example
|
|
223
|
-
*
|
|
248
|
+
*
|
|
249
|
+
* ```ts
|
|
224
250
|
* import { Rettiwt } from 'rettiwt-api';
|
|
225
251
|
*
|
|
226
252
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -256,7 +282,8 @@ export class UserService extends FetcherService {
|
|
|
256
282
|
* @returns - The followed feed of the logged-in user.
|
|
257
283
|
*
|
|
258
284
|
* @example
|
|
259
|
-
*
|
|
285
|
+
*
|
|
286
|
+
* ```ts
|
|
260
287
|
* import { Rettiwt } from 'rettiwt-api';
|
|
261
288
|
*
|
|
262
289
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -291,14 +318,15 @@ export class UserService extends FetcherService {
|
|
|
291
318
|
/**
|
|
292
319
|
* Get the list followers of a user.
|
|
293
320
|
*
|
|
294
|
-
* @param id - The
|
|
321
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
295
322
|
* @param count - The number of followers to fetch, must be \<= 100.
|
|
296
323
|
* @param cursor - The cursor to the batch of followers to fetch.
|
|
297
324
|
*
|
|
298
325
|
* @returns The list of users following the target user.
|
|
299
326
|
*
|
|
300
327
|
* @example
|
|
301
|
-
*
|
|
328
|
+
*
|
|
329
|
+
* ```ts
|
|
302
330
|
* import { Rettiwt } from 'rettiwt-api';
|
|
303
331
|
*
|
|
304
332
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -314,12 +342,12 @@ export class UserService extends FetcherService {
|
|
|
314
342
|
* });
|
|
315
343
|
* ```
|
|
316
344
|
*/
|
|
317
|
-
public async followers(id
|
|
345
|
+
public async followers(id?: string, count?: number, cursor?: string): Promise<CursoredData<User>> {
|
|
318
346
|
const resource = EResourceType.USER_FOLLOWERS;
|
|
319
347
|
|
|
320
348
|
// Fetching raw list of followers
|
|
321
349
|
const response = await this.request<IUserFollowersResponse>(resource, {
|
|
322
|
-
id: id,
|
|
350
|
+
id: id ?? this.config.userId,
|
|
323
351
|
count: count,
|
|
324
352
|
cursor: cursor,
|
|
325
353
|
});
|
|
@@ -333,14 +361,15 @@ export class UserService extends FetcherService {
|
|
|
333
361
|
/**
|
|
334
362
|
* Get the list of users who are followed by a user.
|
|
335
363
|
*
|
|
336
|
-
* @param id - The
|
|
364
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
337
365
|
* @param count - The number of following to fetch, must be \<= 100.
|
|
338
366
|
* @param cursor - The cursor to the batch of following to fetch.
|
|
339
367
|
*
|
|
340
368
|
* @returns The list of users followed by the target user.
|
|
341
369
|
*
|
|
342
370
|
* @example
|
|
343
|
-
*
|
|
371
|
+
*
|
|
372
|
+
* ```ts
|
|
344
373
|
* import { Rettiwt } from 'rettiwt-api';
|
|
345
374
|
*
|
|
346
375
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -356,12 +385,12 @@ export class UserService extends FetcherService {
|
|
|
356
385
|
* });
|
|
357
386
|
* ```
|
|
358
387
|
*/
|
|
359
|
-
public async following(id
|
|
388
|
+
public async following(id?: string, count?: number, cursor?: string): Promise<CursoredData<User>> {
|
|
360
389
|
const resource = EResourceType.USER_FOLLOWING;
|
|
361
390
|
|
|
362
391
|
// Fetching raw list of following
|
|
363
392
|
const response = await this.request<IUserFollowingResponse>(resource, {
|
|
364
|
-
id: id,
|
|
393
|
+
id: id ?? this.config.userId,
|
|
365
394
|
count: count,
|
|
366
395
|
cursor: cursor,
|
|
367
396
|
});
|
|
@@ -375,14 +404,15 @@ export class UserService extends FetcherService {
|
|
|
375
404
|
/**
|
|
376
405
|
* Get the highlighted tweets of a user.
|
|
377
406
|
*
|
|
378
|
-
* @param id - The
|
|
407
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
379
408
|
* @param count - The number of followers to fetch, must be \<= 100.
|
|
380
409
|
* @param cursor - The cursor to the batch of followers to fetch.
|
|
381
410
|
*
|
|
382
411
|
* @returns The list of highlighted tweets of the target user.
|
|
383
412
|
*
|
|
384
413
|
* @example
|
|
385
|
-
*
|
|
414
|
+
*
|
|
415
|
+
* ```ts
|
|
386
416
|
* import { Rettiwt } from 'rettiwt-api';
|
|
387
417
|
*
|
|
388
418
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -403,7 +433,7 @@ export class UserService extends FetcherService {
|
|
|
403
433
|
|
|
404
434
|
// Fetching raw list of highlights
|
|
405
435
|
const response = await this.request<IUserHighlightsResponse>(resource, {
|
|
406
|
-
id: id,
|
|
436
|
+
id: id ?? this.config.userId,
|
|
407
437
|
count: count,
|
|
408
438
|
cursor: cursor,
|
|
409
439
|
});
|
|
@@ -423,7 +453,8 @@ export class UserService extends FetcherService {
|
|
|
423
453
|
* @returns The list of tweets liked by the target user.
|
|
424
454
|
*
|
|
425
455
|
* @example
|
|
426
|
-
*
|
|
456
|
+
*
|
|
457
|
+
* ```ts
|
|
427
458
|
* import { Rettiwt } from 'rettiwt-api';
|
|
428
459
|
*
|
|
429
460
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -458,14 +489,15 @@ export class UserService extends FetcherService {
|
|
|
458
489
|
/**
|
|
459
490
|
* Get the media timeline of a user.
|
|
460
491
|
*
|
|
461
|
-
* @param id - The
|
|
492
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
462
493
|
* @param count - The number of media to fetch, must be \<= 100.
|
|
463
494
|
* @param cursor - The cursor to the batch of media to fetch
|
|
464
495
|
*
|
|
465
496
|
* @returns The media timeline of the target user.
|
|
466
497
|
*
|
|
467
498
|
* @example
|
|
468
|
-
*
|
|
499
|
+
*
|
|
500
|
+
* ```ts
|
|
469
501
|
* import { Rettiwt } from 'rettiwt-api';
|
|
470
502
|
*
|
|
471
503
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -481,12 +513,12 @@ export class UserService extends FetcherService {
|
|
|
481
513
|
* });
|
|
482
514
|
* ```
|
|
483
515
|
*/
|
|
484
|
-
public async media(id
|
|
516
|
+
public async media(id?: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>> {
|
|
485
517
|
const resource = EResourceType.USER_MEDIA;
|
|
486
518
|
|
|
487
519
|
// Fetching raw list of media
|
|
488
520
|
const response = await this.request<IUserMediaResponse>(resource, {
|
|
489
|
-
id: id,
|
|
521
|
+
id: id ?? this.config.userId,
|
|
490
522
|
count: count,
|
|
491
523
|
cursor: cursor,
|
|
492
524
|
});
|
|
@@ -505,7 +537,8 @@ export class UserService extends FetcherService {
|
|
|
505
537
|
* @returns An async generator that yields new notifications as they are received.
|
|
506
538
|
*
|
|
507
539
|
* @example
|
|
508
|
-
*
|
|
540
|
+
*
|
|
541
|
+
* ```ts
|
|
509
542
|
* import { Rettiwt } from 'rettiwt-api';
|
|
510
543
|
*
|
|
511
544
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -515,7 +548,7 @@ export class UserService extends FetcherService {
|
|
|
515
548
|
* async function streamNotifications() {
|
|
516
549
|
* try {
|
|
517
550
|
* // Awaiting for the notifications returned by the AsyncGenerator returned by the method
|
|
518
|
-
* for await (const notification of rettiwt.user.notifications(
|
|
551
|
+
* for await (const notification of rettiwt.user.notifications(5000)) {
|
|
519
552
|
* console.log(notification.message);
|
|
520
553
|
* }
|
|
521
554
|
* }
|
|
@@ -577,7 +610,8 @@ export class UserService extends FetcherService {
|
|
|
577
610
|
* @returns - The recommended feed of the logged-in user.
|
|
578
611
|
*
|
|
579
612
|
* @example
|
|
580
|
-
*
|
|
613
|
+
*
|
|
614
|
+
* ```ts
|
|
581
615
|
* import { Rettiwt } from 'rettiwt-api';
|
|
582
616
|
*
|
|
583
617
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -612,14 +646,15 @@ export class UserService extends FetcherService {
|
|
|
612
646
|
/**
|
|
613
647
|
* Get the reply timeline of a user.
|
|
614
648
|
*
|
|
615
|
-
* @param id - The
|
|
649
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
616
650
|
* @param count - The number of replies to fetch, must be \<= 20.
|
|
617
651
|
* @param cursor - The cursor to the batch of replies to fetch.
|
|
618
652
|
*
|
|
619
653
|
* @returns The reply timeline of the target user.
|
|
620
654
|
*
|
|
621
655
|
* @example
|
|
622
|
-
*
|
|
656
|
+
*
|
|
657
|
+
* ```ts
|
|
623
658
|
* import { Rettiwt } from 'rettiwt-api';
|
|
624
659
|
*
|
|
625
660
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -635,14 +670,16 @@ export class UserService extends FetcherService {
|
|
|
635
670
|
* });
|
|
636
671
|
* ```
|
|
637
672
|
*
|
|
638
|
-
* @remarks
|
|
673
|
+
* @remarks
|
|
674
|
+
*
|
|
675
|
+
* If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
|
|
639
676
|
*/
|
|
640
|
-
public async replies(id
|
|
677
|
+
public async replies(id?: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>> {
|
|
641
678
|
const resource = EResourceType.USER_TIMELINE_AND_REPLIES;
|
|
642
679
|
|
|
643
680
|
// Fetching raw list of replies
|
|
644
681
|
const response = await this.request<IUserTweetsAndRepliesResponse>(resource, {
|
|
645
|
-
id: id,
|
|
682
|
+
id: id ?? this.config.userId,
|
|
646
683
|
count: count,
|
|
647
684
|
cursor: cursor,
|
|
648
685
|
});
|
|
@@ -656,14 +693,17 @@ export class UserService extends FetcherService {
|
|
|
656
693
|
/**
|
|
657
694
|
* Get the list of subscriptions of a user.
|
|
658
695
|
*
|
|
659
|
-
* @
|
|
696
|
+
* @deprecated Currently not working.
|
|
697
|
+
*
|
|
698
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
660
699
|
* @param count - The number of subscriptions to fetch, must be \<= 100.
|
|
661
700
|
* @param cursor - The cursor to the batch of subscriptions to fetch.
|
|
662
701
|
*
|
|
663
702
|
* @returns The list of subscriptions by the target user.
|
|
664
703
|
*
|
|
665
704
|
* @example
|
|
666
|
-
*
|
|
705
|
+
*
|
|
706
|
+
* ```ts
|
|
667
707
|
* import { Rettiwt } from 'rettiwt-api';
|
|
668
708
|
*
|
|
669
709
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -684,7 +724,7 @@ export class UserService extends FetcherService {
|
|
|
684
724
|
|
|
685
725
|
// Fetching raw list of subscriptions
|
|
686
726
|
const response = await this.request<IUserSubscriptionsResponse>(resource, {
|
|
687
|
-
id: id,
|
|
727
|
+
id: id ?? this.config.userId,
|
|
688
728
|
count: count,
|
|
689
729
|
cursor: cursor,
|
|
690
730
|
});
|
|
@@ -698,14 +738,15 @@ export class UserService extends FetcherService {
|
|
|
698
738
|
/**
|
|
699
739
|
* Get the tweet timeline of a user.
|
|
700
740
|
*
|
|
701
|
-
* @param id - The
|
|
741
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
702
742
|
* @param count - The number of timeline items to fetch, must be \<= 20.
|
|
703
743
|
* @param cursor - The cursor to the batch of timeline items to fetch.
|
|
704
744
|
*
|
|
705
745
|
* @returns The timeline of the target user.
|
|
706
746
|
*
|
|
707
747
|
* @example
|
|
708
|
-
*
|
|
748
|
+
*
|
|
749
|
+
* ```ts
|
|
709
750
|
* import { Rettiwt } from 'rettiwt-api';
|
|
710
751
|
*
|
|
711
752
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -722,6 +763,7 @@ export class UserService extends FetcherService {
|
|
|
722
763
|
* ```
|
|
723
764
|
*
|
|
724
765
|
* @remarks
|
|
766
|
+
*
|
|
725
767
|
* - If the target user has a pinned tweet, the returned timeline has one item extra and this is always the pinned tweet.
|
|
726
768
|
* - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
|
|
727
769
|
*/
|
|
@@ -730,7 +772,7 @@ export class UserService extends FetcherService {
|
|
|
730
772
|
|
|
731
773
|
// Fetching raw list of tweets
|
|
732
774
|
const response = await this.request<IUserTweetsResponse>(resource, {
|
|
733
|
-
id: id,
|
|
775
|
+
id: id ?? this.config.userId,
|
|
734
776
|
count: count,
|
|
735
777
|
cursor: cursor,
|
|
736
778
|
});
|
|
@@ -744,14 +786,13 @@ export class UserService extends FetcherService {
|
|
|
744
786
|
/**
|
|
745
787
|
* Unfollow a user.
|
|
746
788
|
*
|
|
747
|
-
* @param id - The
|
|
789
|
+
* @param id - The ID the user to be unfollowed.
|
|
748
790
|
*
|
|
749
791
|
* @returns Whether unfollowing was successful or not.
|
|
750
792
|
*
|
|
751
|
-
* @throws Code 34 if given user id is invalid.
|
|
752
|
-
*
|
|
753
793
|
* @example
|
|
754
|
-
*
|
|
794
|
+
*
|
|
795
|
+
* ```ts
|
|
755
796
|
* import { Rettiwt } from 'rettiwt-api';
|
|
756
797
|
*
|
|
757
798
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ETweetRepliesSortType } from '../../enums/Tweet';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Options specifying the data that is to be fetched.
|
|
3
5
|
*
|
|
@@ -55,6 +57,14 @@ export interface IFetchArgs {
|
|
|
55
57
|
* - Required only for {@link EResourceType.TWEET_DETAILS_BULK} and {@link EResourceType.USER_DETAILS_BY_IDS_BULK}.
|
|
56
58
|
*/
|
|
57
59
|
ids?: string[];
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The sorting to use for tweet results.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* - Only works for {@link EResourceType.TWEET_REPLIES}.
|
|
66
|
+
*/
|
|
67
|
+
sortBy?: ETweetRepliesSortType;
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
/**
|