rettiwt-api 5.0.0-alpha.3 → 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 (162) hide show
  1. package/README.md +160 -87
  2. package/dist/collections/Extractors.d.ts +6 -2
  3. package/dist/collections/Extractors.js +1 -0
  4. package/dist/collections/Extractors.js.map +1 -1
  5. package/dist/collections/Groups.js +1 -0
  6. package/dist/collections/Groups.js.map +1 -1
  7. package/dist/collections/Requests.d.ts +1 -1
  8. package/dist/collections/Requests.js +4 -2
  9. package/dist/collections/Requests.js.map +1 -1
  10. package/dist/collections/Tweet.d.ts +10 -0
  11. package/dist/collections/Tweet.js +17 -0
  12. package/dist/collections/Tweet.js.map +1 -0
  13. package/dist/commands/Tweet.js +0 -16
  14. package/dist/commands/Tweet.js.map +1 -1
  15. package/dist/commands/User.js +15 -15
  16. package/dist/commands/User.js.map +1 -1
  17. package/dist/enums/Api.d.ts +1 -51
  18. package/dist/enums/Api.js +1 -52
  19. package/dist/enums/Api.js.map +1 -1
  20. package/dist/enums/Resource.d.ts +1 -0
  21. package/dist/enums/Resource.js +1 -0
  22. package/dist/enums/Resource.js.map +1 -1
  23. package/dist/enums/Tweet.d.ts +8 -0
  24. package/dist/enums/Tweet.js +13 -0
  25. package/dist/enums/Tweet.js.map +1 -0
  26. package/dist/enums/raw/Tweet.d.ts +11 -1
  27. package/dist/enums/raw/Tweet.js +13 -2
  28. package/dist/enums/raw/Tweet.js.map +1 -1
  29. package/dist/index.d.ts +6 -6
  30. package/dist/index.js +3 -5
  31. package/dist/index.js.map +1 -1
  32. package/dist/models/RettiwtConfig.d.ts +27 -3
  33. package/dist/models/RettiwtConfig.js +37 -4
  34. package/dist/models/RettiwtConfig.js.map +1 -1
  35. package/dist/models/args/FetchArgs.d.ts +3 -3
  36. package/dist/models/args/FetchArgs.js +3 -2
  37. package/dist/models/args/FetchArgs.js.map +1 -1
  38. package/dist/models/args/PostArgs.d.ts +2 -3
  39. package/dist/models/args/PostArgs.js +3 -3
  40. package/dist/models/args/PostArgs.js.map +1 -1
  41. package/dist/models/auth/AuthCookie.d.ts +1 -1
  42. package/dist/models/auth/AuthCookie.js +1 -1
  43. package/dist/models/auth/AuthCredential.d.ts +1 -1
  44. package/dist/models/auth/AuthCredential.js +1 -1
  45. package/dist/models/data/List.d.ts +4 -0
  46. package/dist/models/data/List.js +7 -0
  47. package/dist/models/data/List.js.map +1 -1
  48. package/dist/models/data/Notification.d.ts +4 -0
  49. package/dist/models/data/Notification.js +7 -0
  50. package/dist/models/data/Notification.js.map +1 -1
  51. package/dist/models/data/Tweet.d.ts +4 -0
  52. package/dist/models/data/Tweet.js +7 -0
  53. package/dist/models/data/Tweet.js.map +1 -1
  54. package/dist/models/data/User.d.ts +4 -0
  55. package/dist/models/data/User.js +7 -0
  56. package/dist/models/data/User.js.map +1 -1
  57. package/dist/models/errors/TwitterError.d.ts +37 -0
  58. package/dist/models/errors/TwitterError.js +60 -0
  59. package/dist/models/errors/TwitterError.js.map +1 -0
  60. package/dist/requests/List.js +28 -9
  61. package/dist/requests/List.js.map +1 -1
  62. package/dist/requests/Tweet.d.ts +2 -1
  63. package/dist/requests/Tweet.js +94 -38
  64. package/dist/requests/Tweet.js.map +1 -1
  65. package/dist/requests/User.js +231 -111
  66. package/dist/requests/User.js.map +1 -1
  67. package/dist/services/internal/AuthService.d.ts +6 -6
  68. package/dist/services/internal/AuthService.js +7 -8
  69. package/dist/services/internal/AuthService.js.map +1 -1
  70. package/dist/services/internal/ErrorService.d.ts +5 -76
  71. package/dist/services/internal/ErrorService.js +13 -116
  72. package/dist/services/internal/ErrorService.js.map +1 -1
  73. package/dist/services/internal/TidService.d.ts +4 -5
  74. package/dist/services/internal/TidService.js +18 -24
  75. package/dist/services/internal/TidService.js.map +1 -1
  76. package/dist/services/public/FetcherService.d.ts +4 -3
  77. package/dist/services/public/FetcherService.js +8 -7
  78. package/dist/services/public/FetcherService.js.map +1 -1
  79. package/dist/services/public/ListService.d.ts +6 -4
  80. package/dist/services/public/ListService.js +6 -4
  81. package/dist/services/public/ListService.js.map +1 -1
  82. package/dist/services/public/TweetService.d.ts +96 -74
  83. package/dist/services/public/TweetService.js +97 -87
  84. package/dist/services/public/TweetService.js.map +1 -1
  85. package/dist/services/public/UserService.d.ts +106 -38
  86. package/dist/services/public/UserService.js +126 -43
  87. package/dist/services/public/UserService.js.map +1 -1
  88. package/dist/types/args/FetchArgs.d.ts +8 -0
  89. package/dist/types/errors/TwitterError.d.ts +30 -0
  90. package/dist/types/{raw/generic/Error.js → errors/TwitterError.js} +1 -1
  91. package/dist/types/errors/TwitterError.js.map +1 -0
  92. package/dist/types/raw/base/Error.d.ts +32 -0
  93. package/dist/types/raw/base/Error.js +4 -0
  94. package/dist/types/raw/base/Error.js.map +1 -0
  95. package/dist/types/raw/generic/Response.d.ts +0 -2
  96. package/dist/types/raw/tweet/DetailsBulk.d.ts +288 -0
  97. package/dist/types/raw/tweet/DetailsBulk.js +4 -0
  98. package/dist/types/raw/tweet/DetailsBulk.js.map +1 -0
  99. package/dist/types/raw/user/DetailsBulk.d.ts +91 -0
  100. package/dist/types/raw/user/DetailsBulk.js +4 -0
  101. package/dist/types/raw/user/DetailsBulk.js.map +1 -0
  102. package/package.json +1 -1
  103. package/src/collections/Extractors.ts +8 -2
  104. package/src/collections/Groups.ts +1 -0
  105. package/src/collections/Requests.ts +6 -2
  106. package/src/collections/Tweet.ts +17 -0
  107. package/src/commands/Tweet.ts +0 -16
  108. package/src/commands/User.ts +15 -15
  109. package/src/enums/Api.ts +0 -51
  110. package/src/enums/Resource.ts +1 -0
  111. package/src/enums/Tweet.ts +8 -0
  112. package/src/enums/raw/Tweet.ts +12 -1
  113. package/src/index.ts +6 -6
  114. package/src/models/RettiwtConfig.ts +43 -4
  115. package/src/models/args/FetchArgs.ts +4 -3
  116. package/src/models/args/PostArgs.ts +3 -4
  117. package/src/models/auth/AuthCookie.ts +1 -1
  118. package/src/models/auth/AuthCredential.ts +1 -1
  119. package/src/models/data/List.ts +9 -0
  120. package/src/models/data/Notification.ts +10 -0
  121. package/src/models/data/Tweet.ts +9 -0
  122. package/src/models/data/User.ts +9 -0
  123. package/src/models/errors/TwitterError.ts +65 -0
  124. package/src/requests/List.ts +28 -9
  125. package/src/requests/Tweet.ts +95 -39
  126. package/src/requests/User.ts +231 -111
  127. package/src/services/internal/AuthService.ts +8 -9
  128. package/src/services/internal/ErrorService.ts +14 -132
  129. package/src/services/internal/TidService.ts +21 -28
  130. package/src/services/public/FetcherService.ts +8 -7
  131. package/src/services/public/ListService.ts +6 -4
  132. package/src/services/public/TweetService.ts +104 -95
  133. package/src/services/public/UserService.ts +143 -51
  134. package/src/types/args/FetchArgs.ts +10 -0
  135. package/src/types/errors/TwitterError.ts +37 -0
  136. package/src/types/raw/base/Error.ts +37 -0
  137. package/src/types/raw/generic/Response.ts +0 -3
  138. package/src/types/raw/tweet/DetailsBulk.ts +338 -0
  139. package/src/types/raw/user/DetailsBulk.ts +104 -0
  140. package/dist/enums/Http.d.ts +0 -68
  141. package/dist/enums/Http.js +0 -73
  142. package/dist/enums/Http.js.map +0 -1
  143. package/dist/models/errors/ApiError.d.ts +0 -15
  144. package/dist/models/errors/ApiError.js +0 -23
  145. package/dist/models/errors/ApiError.js.map +0 -1
  146. package/dist/models/errors/HttpError.d.ts +0 -15
  147. package/dist/models/errors/HttpError.js +0 -23
  148. package/dist/models/errors/HttpError.js.map +0 -1
  149. package/dist/models/errors/RettiwtError.d.ts +0 -9
  150. package/dist/models/errors/RettiwtError.js +0 -17
  151. package/dist/models/errors/RettiwtError.js.map +0 -1
  152. package/dist/models/errors/TimeoutError.d.ts +0 -12
  153. package/dist/models/errors/TimeoutError.js +0 -19
  154. package/dist/models/errors/TimeoutError.js.map +0 -1
  155. package/dist/types/raw/generic/Error.d.ts +0 -30
  156. package/dist/types/raw/generic/Error.js.map +0 -1
  157. package/src/enums/Http.ts +0 -68
  158. package/src/models/errors/ApiError.ts +0 -21
  159. package/src/models/errors/HttpError.ts +0 -21
  160. package/src/models/errors/RettiwtError.ts +0 -13
  161. package/src/models/errors/TimeoutError.ts +0 -15
  162. package/src/types/raw/generic/Error.ts +0 -35
@@ -2,6 +2,7 @@ import { statSync } from 'fs';
2
2
 
3
3
  import { extractors } from '../../collections/Extractors';
4
4
  import { EResourceType } from '../../enums/Resource';
5
+ import { ETweetRepliesSortType } from '../../enums/Tweet';
5
6
  import { CursoredData } from '../../models/data/CursoredData';
6
7
  import { Tweet } from '../../models/data/Tweet';
7
8
  import { User } from '../../models/data/User';
@@ -9,10 +10,10 @@ import { User } from '../../models/data/User';
9
10
  import { RettiwtConfig } from '../../models/RettiwtConfig';
10
11
  import { ITweetFilter } from '../../types/args/FetchArgs';
11
12
  import { INewTweet } from '../../types/args/PostArgs';
12
- import { IListTweetsResponse } from '../../types/raw/list/Tweets';
13
13
  import { IMediaInitializeUploadResponse } from '../../types/raw/media/InitalizeUpload';
14
- import { ITweetDetailsResponse } from '../../types/raw/tweet/Details';
15
14
 
15
+ import { ITweetDetailsResponse } from '../../types/raw/tweet/Details';
16
+ import { ITweetDetailsBulkResponse } from '../../types/raw/tweet/DetailsBulk';
16
17
  import { ITweetLikeResponse } from '../../types/raw/tweet/Like';
17
18
  import { ITweetLikersResponse } from '../../types/raw/tweet/Likers';
18
19
  import { ITweetPostResponse } from '../../types/raw/tweet/Post';
@@ -44,16 +45,21 @@ export class TweetService extends FetcherService {
44
45
  }
45
46
 
46
47
  /**
47
- * Get the details of a tweet.
48
+ * Get the details of one or more tweets.
48
49
  *
49
- * @param id - The id(s) of the target tweet/tweets.
50
+ * @param id - The ID/IDs of the target tweet/tweets.
50
51
  *
51
52
  * @returns
52
- * The details of the tweet with the given id.
53
- * If no tweet matches the given id, returns `undefined`.
53
+ * The details of the tweet with the given ID.
54
+ *
55
+ * If more than one ID is provided, returns a list.
56
+ *
57
+ * If no tweet/tweets matches the given ID/IDs, returns `undefined`/`[]`.
54
58
  *
55
59
  * @example
56
- * ```
60
+ *
61
+ * #### Fetching the details of a single tweet
62
+ * ```ts
57
63
  * import { Rettiwt } from 'rettiwt-api';
58
64
  *
59
65
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -62,7 +68,26 @@ export class TweetService extends FetcherService {
62
68
  * // Fetching the details of the tweet with the id '1234567890'
63
69
  * rettiwt.tweet.details('1234567890')
64
70
  * .then(res => {
65
- * console.log(res);
71
+ * console.log(res); # 'res' is a single tweet
72
+ * })
73
+ * .catch(err => {
74
+ * console.log(err);
75
+ * });
76
+ * ```
77
+ *
78
+ * @example
79
+ *
80
+ * #### Fetching the details of multiple tweets
81
+ * ```ts
82
+ * import { Rettiwt } from 'rettiwt-api';
83
+ *
84
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
85
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
86
+ *
87
+ * // Fetching the details of the tweets with IDs '123', '456', '789'
88
+ * rettiwt.tweet.details(['123', '456', '789'])
89
+ * .then(res => {
90
+ * console.log(res); # 'res' is an array of tweets
66
91
  * })
67
92
  * .catch(err => {
68
93
  * console.log(err);
@@ -89,7 +114,7 @@ export class TweetService extends FetcherService {
89
114
  resource = EResourceType.TWEET_DETAILS_BULK;
90
115
 
91
116
  // Fetching raw tweet details
92
- const response = await this.request<ITweetRepliesResponse>(resource, { ids: id });
117
+ const response = await this.request<ITweetDetailsBulkResponse>(resource, { ids: id });
93
118
 
94
119
  // Deserializing response
95
120
  const data = extractors[resource](response, id);
@@ -113,12 +138,13 @@ export class TweetService extends FetcherService {
113
138
  /**
114
139
  * Like a tweet.
115
140
  *
116
- * @param id - The id of the tweet to be liked.
141
+ * @param id - The ID of the tweet to be liked.
117
142
  *
118
143
  * @returns Whether liking was successful or not.
119
144
  *
120
145
  * @example
121
- * ```
146
+ *
147
+ * ```ts
122
148
  * import { Rettiwt } from 'rettiwt-api';
123
149
  *
124
150
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -151,14 +177,15 @@ export class TweetService extends FetcherService {
151
177
  /**
152
178
  * Get the list of users who liked a tweet. Only works for your own tweets.
153
179
  *
154
- * @param id - The id of the target tweet.
180
+ * @param id - The ID of the target tweet.
155
181
  * @param count - The number of likers to fetch, must be \<= 100.
156
182
  * @param cursor - The cursor to the batch of likers to fetch.
157
183
  *
158
184
  * @returns The list of users who liked the given tweet.
159
185
  *
160
186
  * @example
161
- * ```
187
+ *
188
+ * ```ts
162
189
  * import { Rettiwt } from 'rettiwt-api';
163
190
  *
164
191
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -190,63 +217,17 @@ export class TweetService extends FetcherService {
190
217
  return data;
191
218
  }
192
219
 
193
- /**
194
- * Get the list of tweets from a tweet list.
195
- *
196
- * @param id - The id of target list.
197
- * @param count - The number of tweets to fetch, must be \<= 100.
198
- * @param cursor - The cursor to the batch of tweets to fetch.
199
- *
200
- * @returns The list tweets in the given list.
201
- *
202
- * @example
203
- * ```
204
- * import { Rettiwt } from 'rettiwt-api';
205
- *
206
- * // Creating a new Rettiwt instance using the given 'API_KEY'
207
- * const rettiwt = new Rettiwt({ apiKey: API_KEY });
208
- *
209
- * // Fetching the most recent 100 tweets of the Twitter list with id '1234567890'
210
- * rettiwt.tweet.list('1234567890')
211
- * .then(res => {
212
- * console.log(res);
213
- * })
214
- * .catch(err => {
215
- * console.log(err);
216
- * });
217
- * ```
218
- *
219
- * @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
220
- */
221
- public async list(id: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>> {
222
- const resource = EResourceType.LIST_TWEETS;
223
-
224
- // Fetching raw list tweets
225
- const response = await this.request<IListTweetsResponse>(resource, {
226
- id: id,
227
- count: count,
228
- cursor: cursor,
229
- });
230
-
231
- // Deserializing response
232
- const data = extractors[resource](response);
233
-
234
- // Sorting the tweets by date, from recent to oldest
235
- data.list.sort((a, b) => new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf());
236
-
237
- return data;
238
- }
239
-
240
220
  /**
241
221
  * Post a tweet.
242
222
  *
243
223
  * @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
244
224
  *
245
- * @returns The id of the posted tweet.
225
+ * @returns The ID of the posted tweet.
246
226
  *
247
227
  * @example
248
- * Posting a simple text
249
- * ```
228
+ *
229
+ * #### Posting a simple text
230
+ * ```ts
250
231
  * import { Rettiwt } from 'rettiwt-api';
251
232
  *
252
233
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -263,14 +244,15 @@ export class TweetService extends FetcherService {
263
244
  * ```
264
245
  *
265
246
  * @example
266
- * Posting a tweet with an image that has been already uploaded
267
- * ```
247
+ *
248
+ * #### Posting a tweet with an image that has been already uploaded
249
+ * ```ts
268
250
  * import { Rettiwt } from 'rettiwt-api';
269
251
  *
270
252
  * // Creating a new Rettiwt instance using the given 'API_KEY'
271
253
  * const rettiwt = new Rettiwt({ apiKey: API_KEY });
272
254
  *
273
- * // Posting a tweet, containing an image called 'mountains.jpg', to twitter
255
+ * // Posting a tweet, containing an image with ID '1234567890', to twitter
274
256
  * rettiwt.tweet.post({ text: 'What a nice view!', media: [{ id: '1234567890' }] })
275
257
  * .then(res => {
276
258
  * console.log(res);
@@ -281,8 +263,9 @@ export class TweetService extends FetcherService {
281
263
  * ```
282
264
  *
283
265
  * @example
284
- * Posting a reply to a tweet
285
- * ```
266
+ *
267
+ * #### Posting a reply to a tweet
268
+ * ```ts
286
269
  * import { Rettiwt } from 'rettiwt-api';
287
270
  *
288
271
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -298,9 +281,10 @@ export class TweetService extends FetcherService {
298
281
  * });
299
282
  * ```
300
283
  *
301
- * * @example
302
- * Posting a tweet that quotes another tweet
303
- * ```
284
+ * @example
285
+ *
286
+ * #### Posting a tweet that quotes another tweet
287
+ * ```ts
304
288
  * import { Rettiwt } from 'rettiwt-api';
305
289
  *
306
290
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -331,13 +315,15 @@ export class TweetService extends FetcherService {
331
315
  /**
332
316
  * Get the list of replies to a tweet.
333
317
  *
334
- * @param id - The id of the target tweet.
318
+ * @param id - The ID of the target tweet.
335
319
  * @param cursor - The cursor to the batch of replies to fetch.
320
+ * @param sortBy - The sorting order of the replies to fetch. Default is {@link ETweetRepliesSortType.RECENT}.
336
321
  *
337
322
  * @returns The list of replies to the given tweet.
338
323
  *
339
324
  * @example
340
- * ```
325
+ *
326
+ * ```ts
341
327
  * import { Rettiwt } from 'rettiwt-api';
342
328
  *
343
329
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -352,14 +338,23 @@ export class TweetService extends FetcherService {
352
338
  * console.log(err);
353
339
  * });
354
340
  * ```
341
+ *
342
+ * @remarks
343
+ *
344
+ * If the given tweet is the start of/part of a thread, the first batch always contains all the tweets in the thread.
355
345
  */
356
- public async replies(id: string, cursor?: string): Promise<CursoredData<Tweet>> {
346
+ public async replies(
347
+ id: string,
348
+ cursor?: string,
349
+ sortBy: ETweetRepliesSortType = ETweetRepliesSortType.LATEST,
350
+ ): Promise<CursoredData<Tweet>> {
357
351
  const resource = EResourceType.TWEET_REPLIES;
358
352
 
359
353
  // Fetching raw list of replies
360
354
  const response = await this.request<ITweetDetailsResponse>(resource, {
361
355
  id: id,
362
356
  cursor: cursor,
357
+ sortBy: sortBy,
363
358
  });
364
359
 
365
360
  // Deserializing response
@@ -371,12 +366,13 @@ export class TweetService extends FetcherService {
371
366
  /**
372
367
  * Retweet a tweet.
373
368
  *
374
- * @param id - The id of the target tweet.
369
+ * @param id - The ID of the target tweet.
375
370
  *
376
371
  * @returns Whether retweeting was successful or not.
377
372
  *
378
373
  * @example
379
- * ```
374
+ *
375
+ * ```ts
380
376
  * import { Rettiwt } from 'rettiwt-api';
381
377
  *
382
378
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -407,14 +403,15 @@ export class TweetService extends FetcherService {
407
403
  /**
408
404
  * Get the list of users who retweeted a tweet.
409
405
  *
410
- * @param id - The id of the target tweet.
406
+ * @param id - The ID of the target tweet.
411
407
  * @param count - The number of retweeters to fetch, must be \<= 100.
412
408
  * @param cursor - The cursor to the batch of retweeters to fetch.
413
409
  *
414
410
  * @returns The list of users who retweeted the given tweet.
415
411
  *
416
412
  * @example
417
- * ```
413
+ *
414
+ * ```ts
418
415
  * import { Rettiwt } from 'rettiwt-api';
419
416
  *
420
417
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -451,11 +448,12 @@ export class TweetService extends FetcherService {
451
448
  *
452
449
  * @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
453
450
  *
454
- * @returns The id of the schedule.
451
+ * @returns The ID of the schedule.
455
452
  *
456
453
  * @example
457
- * Scheduling a simple text
458
- * ```
454
+ *
455
+ * #### Scheduling a simple text
456
+ * ```ts
459
457
  * import { Rettiwt } from 'rettiwt-api';
460
458
  *
461
459
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -472,6 +470,7 @@ export class TweetService extends FetcherService {
472
470
  * ```
473
471
  *
474
472
  * @remarks
473
+ *
475
474
  * Scheduling a tweet is similar to {@link post}ing, except that an extra parameter called `scheduleFor` is used.
476
475
  */
477
476
  public async schedule(options: INewTweet): Promise<string | undefined> {
@@ -497,7 +496,8 @@ export class TweetService extends FetcherService {
497
496
  * @returns The list of tweets that match the given filter.
498
497
  *
499
498
  * @example
500
- * ```
499
+ *
500
+ * ```ts
501
501
  * import { Rettiwt } from 'rettiwt-api';
502
502
  *
503
503
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -513,7 +513,9 @@ export class TweetService extends FetcherService {
513
513
  * });
514
514
  * ```
515
515
  *
516
- * @remarks For details about available filters, refer to {@link TweetFilter}
516
+ * @remarks
517
+ *
518
+ * For details about available filters, refer to {@link TweetFilter}
517
519
  */
518
520
  public async search(filter: ITweetFilter, count?: number, cursor?: string): Promise<CursoredData<Tweet>> {
519
521
  const resource = EResourceType.TWEET_SEARCH;
@@ -543,7 +545,8 @@ export class TweetService extends FetcherService {
543
545
  * @returns An async generator that yields matching tweets as they are found.
544
546
  *
545
547
  * @example
546
- * ```
548
+ *
549
+ * ```ts
547
550
  * import { Rettiwt } from 'rettiwt-api';
548
551
  *
549
552
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -553,7 +556,7 @@ export class TweetService extends FetcherService {
553
556
  * async function streamTweets() {
554
557
  * try {
555
558
  * // Awaiting for the tweets returned by the AsyncGenerator returned by the method
556
- * for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] }, 1000)) {
559
+ * for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] }, 5000)) {
557
560
  * console.log(tweet.fullText);
558
561
  * }
559
562
  * }
@@ -605,12 +608,13 @@ export class TweetService extends FetcherService {
605
608
  /**
606
609
  * Unlike a tweet.
607
610
  *
608
- * @param id - The id of the target tweet.
611
+ * @param id - The ID of the target tweet.
609
612
  *
610
613
  * @returns Whether unliking was successful or not.
611
614
  *
612
615
  * @example
613
- * ```
616
+ *
617
+ * ```ts
614
618
  * import { Rettiwt } from 'rettiwt-api';
615
619
  *
616
620
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -641,12 +645,13 @@ export class TweetService extends FetcherService {
641
645
  /**
642
646
  * Unpost a tweet.
643
647
  *
644
- * @param id - The id of the target tweet.
648
+ * @param id - The ID of the target tweet.
645
649
  *
646
650
  * @returns Whether unposting was successful or not.
647
651
  *
648
652
  * @example
649
- * ```
653
+ *
654
+ * ```ts
650
655
  * import { Rettiwt } from 'rettiwt-api';
651
656
  *
652
657
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -677,12 +682,13 @@ export class TweetService extends FetcherService {
677
682
  /**
678
683
  * Unretweet a tweet.
679
684
  *
680
- * @param id - The id of the target tweet.
685
+ * @param id - The ID of the target tweet.
681
686
  *
682
687
  * @returns Whether unretweeting was successful or not.
683
688
  *
684
689
  * @example
685
- * ```
690
+ *
691
+ * ```ts
686
692
  * import { Rettiwt } from 'rettiwt-api';
687
693
  *
688
694
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -713,12 +719,13 @@ export class TweetService extends FetcherService {
713
719
  /**
714
720
  * Unschedule a tweet.
715
721
  *
716
- * @param id - The id of the scheduled tweet.
722
+ * @param id - The ID of the scheduled tweet.
717
723
  *
718
724
  * @returns Whether unscheduling was successful or not.
719
725
  *
720
726
  * @example
721
- * ```
727
+ *
728
+ * ```ts
722
729
  * import { Rettiwt } from 'rettiwt-api';
723
730
  *
724
731
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -751,10 +758,11 @@ export class TweetService extends FetcherService {
751
758
  *
752
759
  * @param media - The path or ArrayBuffer to the media file to upload.
753
760
  *
754
- * @returns The id of the uploaded media.
761
+ * @returns The ID of the uploaded media.
755
762
  *
756
763
  * @example
757
- * ```
764
+ *
765
+ * ```ts
758
766
  * import { Rettiwt } from 'rettiwt-api';
759
767
  *
760
768
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -771,6 +779,7 @@ export class TweetService extends FetcherService {
771
779
  * ```
772
780
  *
773
781
  * @remarks
782
+ *
774
783
  * - The uploaded media exists for 24 hrs within which it can be included in a tweet to be posted.
775
784
  * If not posted in a tweet within this period, the uploaded media is removed.
776
785
  * - Instead of a path to the media, an ArrayBuffer containing the media can also be uploaded.