rettiwt-api 5.0.0-alpha.4 → 5.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.
Files changed (91) hide show
  1. package/README.md +160 -87
  2. package/dist/collections/Requests.d.ts +1 -1
  3. package/dist/collections/Requests.js +3 -2
  4. package/dist/collections/Requests.js.map +1 -1
  5. package/dist/collections/Tweet.d.ts +10 -0
  6. package/dist/collections/Tweet.js +17 -0
  7. package/dist/collections/Tweet.js.map +1 -0
  8. package/dist/commands/Tweet.js +0 -16
  9. package/dist/commands/Tweet.js.map +1 -1
  10. package/dist/commands/User.js +0 -15
  11. package/dist/commands/User.js.map +1 -1
  12. package/dist/enums/Tweet.d.ts +8 -0
  13. package/dist/enums/Tweet.js +13 -0
  14. package/dist/enums/Tweet.js.map +1 -0
  15. package/dist/enums/raw/Tweet.d.ts +11 -1
  16. package/dist/enums/raw/Tweet.js +13 -2
  17. package/dist/enums/raw/Tweet.js.map +1 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +1 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/models/RettiwtConfig.d.ts +27 -3
  22. package/dist/models/RettiwtConfig.js +37 -4
  23. package/dist/models/RettiwtConfig.js.map +1 -1
  24. package/dist/models/args/FetchArgs.d.ts +3 -3
  25. package/dist/models/args/FetchArgs.js +3 -2
  26. package/dist/models/args/FetchArgs.js.map +1 -1
  27. package/dist/models/args/PostArgs.d.ts +2 -3
  28. package/dist/models/args/PostArgs.js +3 -3
  29. package/dist/models/args/PostArgs.js.map +1 -1
  30. package/dist/models/auth/AuthCookie.d.ts +1 -1
  31. package/dist/models/auth/AuthCookie.js +1 -1
  32. package/dist/models/auth/AuthCredential.d.ts +1 -1
  33. package/dist/models/auth/AuthCredential.js +1 -1
  34. package/dist/models/data/List.d.ts +1 -1
  35. package/dist/models/data/List.js +1 -1
  36. package/dist/models/data/List.js.map +1 -1
  37. package/dist/models/data/Notification.d.ts +1 -1
  38. package/dist/models/data/Notification.js +1 -1
  39. package/dist/models/data/Notification.js.map +1 -1
  40. package/dist/models/data/Tweet.d.ts +1 -1
  41. package/dist/models/data/Tweet.js +1 -1
  42. package/dist/models/data/Tweet.js.map +1 -1
  43. package/dist/models/data/User.d.ts +1 -1
  44. package/dist/models/data/User.js +1 -1
  45. package/dist/models/data/User.js.map +1 -1
  46. package/dist/requests/Tweet.d.ts +2 -1
  47. package/dist/requests/Tweet.js +3 -4
  48. package/dist/requests/Tweet.js.map +1 -1
  49. package/dist/services/internal/AuthService.d.ts +1 -1
  50. package/dist/services/internal/AuthService.js +1 -1
  51. package/dist/services/internal/TidService.d.ts +0 -1
  52. package/dist/services/internal/TidService.js +10 -15
  53. package/dist/services/internal/TidService.js.map +1 -1
  54. package/dist/services/public/FetcherService.d.ts +4 -3
  55. package/dist/services/public/FetcherService.js +6 -5
  56. package/dist/services/public/FetcherService.js.map +1 -1
  57. package/dist/services/public/ListService.d.ts +6 -4
  58. package/dist/services/public/ListService.js +6 -4
  59. package/dist/services/public/ListService.js.map +1 -1
  60. package/dist/services/public/TweetService.d.ts +96 -74
  61. package/dist/services/public/TweetService.js +97 -87
  62. package/dist/services/public/TweetService.js.map +1 -1
  63. package/dist/services/public/UserService.d.ts +80 -39
  64. package/dist/services/public/UserService.js +84 -43
  65. package/dist/services/public/UserService.js.map +1 -1
  66. package/dist/types/args/FetchArgs.d.ts +8 -0
  67. package/package.json +1 -1
  68. package/src/collections/Requests.ts +5 -2
  69. package/src/collections/Tweet.ts +17 -0
  70. package/src/commands/Tweet.ts +0 -16
  71. package/src/commands/User.ts +0 -15
  72. package/src/enums/Tweet.ts +8 -0
  73. package/src/enums/raw/Tweet.ts +12 -1
  74. package/src/index.ts +1 -0
  75. package/src/models/RettiwtConfig.ts +43 -4
  76. package/src/models/args/FetchArgs.ts +4 -3
  77. package/src/models/args/PostArgs.ts +3 -4
  78. package/src/models/auth/AuthCookie.ts +1 -1
  79. package/src/models/auth/AuthCredential.ts +1 -1
  80. package/src/models/data/List.ts +1 -1
  81. package/src/models/data/Notification.ts +1 -1
  82. package/src/models/data/Tweet.ts +1 -1
  83. package/src/models/data/User.ts +1 -1
  84. package/src/requests/Tweet.ts +4 -5
  85. package/src/services/internal/AuthService.ts +1 -1
  86. package/src/services/internal/TidService.ts +12 -18
  87. package/src/services/public/FetcherService.ts +6 -5
  88. package/src/services/public/ListService.ts +6 -4
  89. package/src/services/public/TweetService.ts +101 -93
  90. package/src/services/public/UserService.ts +88 -47
  91. package/src/types/args/FetchArgs.ts +10 -0
@@ -19,14 +19,15 @@ export declare class UserService extends FetcherService {
19
19
  /**
20
20
  * Get the list affiliates of a user.
21
21
  *
22
- * @param id - The id of the target user.
22
+ * @param id - The ID of the target user. If no id is provided, the logged-in user's id is used.
23
23
  * @param count - The number of affiliates to fetch, must be \<= 100.
24
24
  * @param cursor - The cursor to the batch of affiliates to fetch.
25
25
  *
26
26
  * @returns The list of users affiliated to the target user.
27
27
  *
28
28
  * @example
29
- * ```
29
+ *
30
+ * ```ts
30
31
  * import { Rettiwt } from 'rettiwt-api';
31
32
  *
32
33
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -52,7 +53,8 @@ export declare class UserService extends FetcherService {
52
53
  * @returns The list of tweets bookmarked by the target user.
53
54
  *
54
55
  * @example
55
- * ```
56
+ *
57
+ * ```ts
56
58
  * import { Rettiwt } from 'rettiwt-api';
57
59
  *
58
60
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -72,15 +74,19 @@ export declare class UserService extends FetcherService {
72
74
  /**
73
75
  * Get the details of a user.
74
76
  *
75
- * @param id - The username/id(s) of the target user/users. If no ID is provided, uses ID of authenticated user.
77
+ * @param id - The username/ID/IDs of the target user/users. If no ID is provided, the logged-in user's ID is used.
76
78
  *
77
79
  * @returns
78
80
  * The details of the given user.
81
+ *
82
+ * If more than one ID is provided, returns a list.
83
+ *
79
84
  * If no user matches the given id, returns `undefined`.
80
85
  *
81
86
  * @example
82
- * Fetching the details using username
83
- * ```
87
+ *
88
+ * #### Fetching the details of a single user using username
89
+ * ```ts
84
90
  * import { Rettiwt } from 'rettiwt-api';
85
91
  *
86
92
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -97,8 +103,9 @@ export declare class UserService extends FetcherService {
97
103
  * ```
98
104
  *
99
105
  * @example
100
- * Fetching the details using id
101
- * ```
106
+ *
107
+ * #### Fetching the details of a single user using ID
108
+ * ```ts
102
109
  * import { Rettiwt } from 'rettiwt-api';
103
110
  *
104
111
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -107,7 +114,25 @@ export declare class UserService extends FetcherService {
107
114
  * // Fetching the details of the User with id '1234567890'
108
115
  * rettiwt.user.details('1234567890')
109
116
  * .then(res => {
110
- * console.log(res);
117
+ * console.log(res); # 'res' is a single tweet
118
+ * })
119
+ * .catch(err => {
120
+ * console.log(err);
121
+ * });
122
+ * ```
123
+ * * @example
124
+ *
125
+ * #### Fetching the details of multiple users
126
+ * ```ts
127
+ * import { Rettiwt } from 'rettiwt-api';
128
+ *
129
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
130
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
131
+ *
132
+ * // Fetching the details of the users with IDs '123', '456', '789'
133
+ * rettiwt.user.details(['123', '456', '789'])
134
+ * .then(res => {
135
+ * console.log(res); # 'res' is an array of users
111
136
  * })
112
137
  * .catch(err => {
113
138
  * console.log(err);
@@ -118,14 +143,15 @@ export declare class UserService extends FetcherService {
118
143
  /**
119
144
  * Follow a user.
120
145
  *
121
- * @param id - The id the user to be followed.
146
+ * @param id - The ID the user to be followed.
122
147
  *
123
148
  * @returns Whether following was successful or not.
124
149
  *
125
150
  * @throws Code 108 if given user id is invalid.
126
151
  *
127
152
  * @example
128
- * ```
153
+ *
154
+ * ```ts
129
155
  * import { Rettiwt } from 'rettiwt-api';
130
156
  *
131
157
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -150,7 +176,8 @@ export declare class UserService extends FetcherService {
150
176
  * @returns - The followed feed of the logged-in user.
151
177
  *
152
178
  * @example
153
- * ```
179
+ *
180
+ * ```ts
154
181
  * import { Rettiwt } from 'rettiwt-api';
155
182
  *
156
183
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -172,14 +199,15 @@ export declare class UserService extends FetcherService {
172
199
  /**
173
200
  * Get the list followers of a user.
174
201
  *
175
- * @param id - The id of the target user.
202
+ * @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
176
203
  * @param count - The number of followers to fetch, must be \<= 100.
177
204
  * @param cursor - The cursor to the batch of followers to fetch.
178
205
  *
179
206
  * @returns The list of users following the target user.
180
207
  *
181
208
  * @example
182
- * ```
209
+ *
210
+ * ```ts
183
211
  * import { Rettiwt } from 'rettiwt-api';
184
212
  *
185
213
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -195,18 +223,19 @@ export declare class UserService extends FetcherService {
195
223
  * });
196
224
  * ```
197
225
  */
198
- followers(id: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
226
+ followers(id?: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
199
227
  /**
200
228
  * Get the list of users who are followed by a user.
201
229
  *
202
- * @param id - The id of the target user.
230
+ * @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
203
231
  * @param count - The number of following to fetch, must be \<= 100.
204
232
  * @param cursor - The cursor to the batch of following to fetch.
205
233
  *
206
234
  * @returns The list of users followed by the target user.
207
235
  *
208
236
  * @example
209
- * ```
237
+ *
238
+ * ```ts
210
239
  * import { Rettiwt } from 'rettiwt-api';
211
240
  *
212
241
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -222,18 +251,19 @@ export declare class UserService extends FetcherService {
222
251
  * });
223
252
  * ```
224
253
  */
225
- following(id: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
254
+ following(id?: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
226
255
  /**
227
256
  * Get the highlighted tweets of a user.
228
257
  *
229
- * @param id - The id of the target user.
258
+ * @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
230
259
  * @param count - The number of followers to fetch, must be \<= 100.
231
260
  * @param cursor - The cursor to the batch of followers to fetch.
232
261
  *
233
262
  * @returns The list of highlighted tweets of the target user.
234
263
  *
235
264
  * @example
236
- * ```
265
+ *
266
+ * ```ts
237
267
  * import { Rettiwt } from 'rettiwt-api';
238
268
  *
239
269
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -259,7 +289,8 @@ export declare class UserService extends FetcherService {
259
289
  * @returns The list of tweets liked by the target user.
260
290
  *
261
291
  * @example
262
- * ```
292
+ *
293
+ * ```ts
263
294
  * import { Rettiwt } from 'rettiwt-api';
264
295
  *
265
296
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -279,14 +310,15 @@ export declare class UserService extends FetcherService {
279
310
  /**
280
311
  * Get the media timeline of a user.
281
312
  *
282
- * @param id - The id of the target user.
313
+ * @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
283
314
  * @param count - The number of media to fetch, must be \<= 100.
284
315
  * @param cursor - The cursor to the batch of media to fetch
285
316
  *
286
317
  * @returns The media timeline of the target user.
287
318
  *
288
319
  * @example
289
- * ```
320
+ *
321
+ * ```ts
290
322
  * import { Rettiwt } from 'rettiwt-api';
291
323
  *
292
324
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -302,7 +334,7 @@ export declare class UserService extends FetcherService {
302
334
  * });
303
335
  * ```
304
336
  */
305
- media(id: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
337
+ media(id?: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
306
338
  /**
307
339
  * Stream notifications of the logged in user in pseudo real-time.
308
340
  *
@@ -311,7 +343,8 @@ export declare class UserService extends FetcherService {
311
343
  * @returns An async generator that yields new notifications as they are received.
312
344
  *
313
345
  * @example
314
- * ```
346
+ *
347
+ * ```ts
315
348
  * import { Rettiwt } from 'rettiwt-api';
316
349
  *
317
350
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -321,7 +354,7 @@ export declare class UserService extends FetcherService {
321
354
  * async function streamNotifications() {
322
355
  * try {
323
356
  * // Awaiting for the notifications returned by the AsyncGenerator returned by the method
324
- * for await (const notification of rettiwt.user.notifications(1000)) {
357
+ * for await (const notification of rettiwt.user.notifications(5000)) {
325
358
  * console.log(notification.message);
326
359
  * }
327
360
  * }
@@ -343,7 +376,8 @@ export declare class UserService extends FetcherService {
343
376
  * @returns - The recommended feed of the logged-in user.
344
377
  *
345
378
  * @example
346
- * ```
379
+ *
380
+ * ```ts
347
381
  * import { Rettiwt } from 'rettiwt-api';
348
382
  *
349
383
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -365,14 +399,15 @@ export declare class UserService extends FetcherService {
365
399
  /**
366
400
  * Get the reply timeline of a user.
367
401
  *
368
- * @param id - The id of the target user.
402
+ * @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
369
403
  * @param count - The number of replies to fetch, must be \<= 20.
370
404
  * @param cursor - The cursor to the batch of replies to fetch.
371
405
  *
372
406
  * @returns The reply timeline of the target user.
373
407
  *
374
408
  * @example
375
- * ```
409
+ *
410
+ * ```ts
376
411
  * import { Rettiwt } from 'rettiwt-api';
377
412
  *
378
413
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -388,20 +423,25 @@ export declare class UserService extends FetcherService {
388
423
  * });
389
424
  * ```
390
425
  *
391
- * @remarks If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
426
+ * @remarks
427
+ *
428
+ * If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
392
429
  */
393
- replies(id: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
430
+ replies(id?: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
394
431
  /**
395
432
  * Get the list of subscriptions of a user.
396
433
  *
397
- * @param id - The id of the target user.
434
+ * @deprecated Currently not working.
435
+ *
436
+ * @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
398
437
  * @param count - The number of subscriptions to fetch, must be \<= 100.
399
438
  * @param cursor - The cursor to the batch of subscriptions to fetch.
400
439
  *
401
440
  * @returns The list of subscriptions by the target user.
402
441
  *
403
442
  * @example
404
- * ```
443
+ *
444
+ * ```ts
405
445
  * import { Rettiwt } from 'rettiwt-api';
406
446
  *
407
447
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -421,14 +461,15 @@ export declare class UserService extends FetcherService {
421
461
  /**
422
462
  * Get the tweet timeline of a user.
423
463
  *
424
- * @param id - The id of the target user.
464
+ * @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
425
465
  * @param count - The number of timeline items to fetch, must be \<= 20.
426
466
  * @param cursor - The cursor to the batch of timeline items to fetch.
427
467
  *
428
468
  * @returns The timeline of the target user.
429
469
  *
430
470
  * @example
431
- * ```
471
+ *
472
+ * ```ts
432
473
  * import { Rettiwt } from 'rettiwt-api';
433
474
  *
434
475
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -445,6 +486,7 @@ export declare class UserService extends FetcherService {
445
486
  * ```
446
487
  *
447
488
  * @remarks
489
+ *
448
490
  * - If the target user has a pinned tweet, the returned timeline has one item extra and this is always the pinned tweet.
449
491
  * - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
450
492
  */
@@ -452,14 +494,13 @@ export declare class UserService extends FetcherService {
452
494
  /**
453
495
  * Unfollow a user.
454
496
  *
455
- * @param id - The id the user to be unfollowed.
497
+ * @param id - The ID the user to be unfollowed.
456
498
  *
457
499
  * @returns Whether unfollowing was successful or not.
458
500
  *
459
- * @throws Code 34 if given user id is invalid.
460
- *
461
501
  * @example
462
- * ```
502
+ *
503
+ * ```ts
463
504
  * import { Rettiwt } from 'rettiwt-api';
464
505
  *
465
506
  * // Creating a new Rettiwt instance using the given 'API_KEY'