rettiwt-api 2.3.1 → 2.4.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 (62) hide show
  1. package/README.md +79 -11
  2. package/dist/Rettiwt.d.ts +37 -1
  3. package/dist/Rettiwt.js +37 -1
  4. package/dist/Rettiwt.js.map +1 -1
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +39 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/Auth.d.ts +3 -0
  9. package/dist/commands/Auth.js +90 -0
  10. package/dist/commands/Auth.js.map +1 -0
  11. package/dist/commands/Tweet.d.ts +10 -0
  12. package/dist/commands/Tweet.js +242 -0
  13. package/dist/commands/Tweet.js.map +1 -0
  14. package/dist/commands/User.d.ts +10 -0
  15. package/dist/commands/User.js +162 -0
  16. package/dist/commands/User.js.map +1 -0
  17. package/dist/helper/CliUtils.d.ts +6 -0
  18. package/dist/helper/CliUtils.js +20 -0
  19. package/dist/helper/CliUtils.js.map +1 -0
  20. package/dist/index.d.ts +2 -0
  21. package/dist/index.js +3 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/models/internal/RettiwtConfig.d.ts +1 -3
  24. package/dist/models/internal/RettiwtConfig.js +1 -0
  25. package/dist/models/internal/RettiwtConfig.js.map +1 -1
  26. package/dist/models/public/CursoredData.d.ts +0 -3
  27. package/dist/models/public/CursoredData.js +0 -1
  28. package/dist/models/public/CursoredData.js.map +1 -1
  29. package/dist/models/public/List.d.ts +0 -7
  30. package/dist/models/public/List.js.map +1 -1
  31. package/dist/models/public/Tweet.d.ts +0 -20
  32. package/dist/models/public/Tweet.js +0 -4
  33. package/dist/models/public/Tweet.js.map +1 -1
  34. package/dist/models/public/User.d.ts +0 -14
  35. package/dist/models/public/User.js.map +1 -1
  36. package/dist/services/internal/FetcherService.d.ts +7 -0
  37. package/dist/services/internal/FetcherService.js +23 -1
  38. package/dist/services/internal/FetcherService.js.map +1 -1
  39. package/dist/services/public/TweetService.d.ts +138 -0
  40. package/dist/services/public/TweetService.js +138 -0
  41. package/dist/services/public/TweetService.js.map +1 -1
  42. package/dist/services/public/UserService.d.ts +119 -0
  43. package/dist/services/public/UserService.js +119 -0
  44. package/dist/services/public/UserService.js.map +1 -1
  45. package/dist/types/internal/RettiwtConfig.d.ts +2 -0
  46. package/package.json +5 -1
  47. package/src/Rettiwt.ts +37 -1
  48. package/src/cli.ts +40 -0
  49. package/src/commands/Auth.ts +45 -0
  50. package/src/commands/Tweet.ts +163 -0
  51. package/src/commands/User.ts +85 -0
  52. package/src/helper/CliUtils.ts +15 -0
  53. package/src/index.ts +2 -0
  54. package/src/models/internal/RettiwtConfig.ts +2 -5
  55. package/src/models/public/CursoredData.ts +0 -4
  56. package/src/models/public/List.ts +0 -13
  57. package/src/models/public/Tweet.ts +0 -37
  58. package/src/models/public/User.ts +0 -27
  59. package/src/services/internal/FetcherService.ts +25 -1
  60. package/src/services/public/TweetService.ts +138 -0
  61. package/src/services/public/UserService.ts +119 -0
  62. package/src/types/internal/RettiwtConfig.ts +3 -0
@@ -22,6 +22,23 @@ export declare class TweetService extends FetcherService {
22
22
  * @param id - The id of the target tweet.
23
23
  * @returns The details of a single tweet with the given tweet id.
24
24
  *
25
+ * @example
26
+ * ```
27
+ * import { Rettiwt } from 'rettiwt-api';
28
+ *
29
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
30
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
31
+ *
32
+ * // Fetching the details of the tweet with the id '12345678'
33
+ * rettiwt.tweet.details('12345678')
34
+ * .then(res => {
35
+ * console.log(res);
36
+ * })
37
+ * .catch(err => {
38
+ * console.log(err);
39
+ * });
40
+ * ```
41
+ *
25
42
  * @public
26
43
  */
27
44
  details(id: string): Promise<Tweet>;
@@ -33,6 +50,25 @@ export declare class TweetService extends FetcherService {
33
50
  * @param cursor - The cursor to the batch of tweets to fetch.
34
51
  * @returns The list of tweets that match the given filter.
35
52
  *
53
+ * @example
54
+ * ```
55
+ * import { Rettiwt } from 'rettiwt-api';
56
+ *
57
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
58
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
59
+ *
60
+ * // Fetching the most recent 5 tweets from user 'user1'
61
+ * rettiwt.tweet.search({ fromUsers: ['user1'] }, 5)
62
+ * .then(res => {
63
+ * console.log(res);
64
+ * })
65
+ * .catch(err => {
66
+ * console.log(err);
67
+ * });
68
+ * ```
69
+ *
70
+ * @remarks For details about available filters, refer to {@link TweetFilter}
71
+ *
36
72
  * @public
37
73
  */
38
74
  search(query: TweetFilter, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
@@ -44,6 +80,23 @@ export declare class TweetService extends FetcherService {
44
80
  * @param cursor - The cursor to the batch of tweets to fetch.
45
81
  * @returns The list tweets present in the given list.
46
82
  *
83
+ * @example
84
+ * ```
85
+ * import { Rettiwt } from 'rettiwt-api';
86
+ *
87
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
88
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
89
+ *
90
+ * // Fetching the most recent 100 tweets of the Twitter list with id '12345678'
91
+ * rettiwt.tweet.list('12345678')
92
+ * .then(res => {
93
+ * console.log(res);
94
+ * })
95
+ * .catch(err => {
96
+ * console.log(err);
97
+ * });
98
+ * ```
99
+ *
47
100
  * @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
48
101
  */
49
102
  list(listId: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
@@ -55,6 +108,23 @@ export declare class TweetService extends FetcherService {
55
108
  * @param cursor - The cursor to the batch of favoriters to fetch.
56
109
  * @returns The list of users who liked the given tweet.
57
110
  *
111
+ * @example
112
+ * ```
113
+ * import { Rettiwt } from 'rettiwt-api';
114
+ *
115
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
116
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
117
+ *
118
+ * // Fetching the most recent 100 likers of the Tweet with id '12345678'
119
+ * rettiwt.tweet.favoriters('12345678')
120
+ * .then(res => {
121
+ * console.log(res);
122
+ * })
123
+ * .catch(err => {
124
+ * console.log(err);
125
+ * });
126
+ * ```
127
+ *
58
128
  * @public
59
129
  */
60
130
  favoriters(tweetId: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
@@ -66,6 +136,23 @@ export declare class TweetService extends FetcherService {
66
136
  * @param cursor - The cursor to the batch of retweeters to fetch.
67
137
  * @returns The list of users who retweeted the given tweet.
68
138
  *
139
+ * @example
140
+ * ```
141
+ * import { Rettiwt } from 'rettiwt-api';
142
+ *
143
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
144
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
145
+ *
146
+ * // Fetching the most recent 100 retweeters of the Tweet with id '12345678'
147
+ * rettiwt.tweet.retweeters('12345678')
148
+ * .then(res => {
149
+ * console.log(res);
150
+ * })
151
+ * .catch(err => {
152
+ * console.log(err);
153
+ * });
154
+ * ```
155
+ *
69
156
  * @public
70
157
  */
71
158
  retweeters(tweetId: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
@@ -75,6 +162,23 @@ export declare class TweetService extends FetcherService {
75
162
  * @param tweetText - The text to be posted, length must be \<= 280 characters.
76
163
  * @returns Whether posting was successful or not.
77
164
  *
165
+ * @example
166
+ * ```
167
+ * import { Rettiwt } from 'rettiwt-api';
168
+ *
169
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
170
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
171
+ *
172
+ * // Posting a tweet to twitter
173
+ * rettiwt.tweet.tweet('Hello World!')
174
+ * .then(res => {
175
+ * console.log(res);
176
+ * })
177
+ * .catch(err => {
178
+ * console.log(err);
179
+ * });
180
+ * ```
181
+ *
78
182
  * @public
79
183
  */
80
184
  tweet(tweetText: string): Promise<boolean>;
@@ -84,6 +188,23 @@ export declare class TweetService extends FetcherService {
84
188
  * @param tweetId - The id of the tweet to be favorited.
85
189
  * @returns Whether favoriting was successful or not.
86
190
  *
191
+ * @example
192
+ * ```
193
+ * import { Rettiwt } from 'rettiwt-api';
194
+ *
195
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
196
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
197
+ *
198
+ * // Liking the Tweet with id '12345678'
199
+ * rettiwt.tweet.favorite('12345678')
200
+ * .then(res => {
201
+ * console.log(res);
202
+ * })
203
+ * .catch(err => {
204
+ * console.log(err);
205
+ * });
206
+ * ```
207
+ *
87
208
  * @public
88
209
  */
89
210
  favorite(tweetId: string): Promise<boolean>;
@@ -93,6 +214,23 @@ export declare class TweetService extends FetcherService {
93
214
  * @param tweetId - The id of the tweet with the given id.
94
215
  * @returns Whether retweeting was successful or not.
95
216
  *
217
+ * @example
218
+ * ```
219
+ * import { Rettiwt } from 'rettiwt-api';
220
+ *
221
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
222
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
223
+ *
224
+ * // Retweeting the Tweet with id '12345678'
225
+ * rettiwt.tweet.retweet('12345678')
226
+ * .then(res => {
227
+ * console.log(res);
228
+ * })
229
+ * .catch(err => {
230
+ * console.log(err);
231
+ * });
232
+ * ```
233
+ *
96
234
  * @public
97
235
  */
98
236
  retweet(tweetId: string): Promise<boolean>;
@@ -77,6 +77,23 @@ var TweetService = /** @class */ (function (_super) {
77
77
  * @param id - The id of the target tweet.
78
78
  * @returns The details of a single tweet with the given tweet id.
79
79
  *
80
+ * @example
81
+ * ```
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 tweet with the id '12345678'
88
+ * rettiwt.tweet.details('12345678')
89
+ * .then(res => {
90
+ * console.log(res);
91
+ * })
92
+ * .catch(err => {
93
+ * console.log(err);
94
+ * });
95
+ * ```
96
+ *
80
97
  * @public
81
98
  */
82
99
  TweetService.prototype.details = function (id) {
@@ -100,6 +117,25 @@ var TweetService = /** @class */ (function (_super) {
100
117
  * @param cursor - The cursor to the batch of tweets to fetch.
101
118
  * @returns The list of tweets that match the given filter.
102
119
  *
120
+ * @example
121
+ * ```
122
+ * import { Rettiwt } from 'rettiwt-api';
123
+ *
124
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
125
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
126
+ *
127
+ * // Fetching the most recent 5 tweets from user 'user1'
128
+ * rettiwt.tweet.search({ fromUsers: ['user1'] }, 5)
129
+ * .then(res => {
130
+ * console.log(res);
131
+ * })
132
+ * .catch(err => {
133
+ * console.log(err);
134
+ * });
135
+ * ```
136
+ *
137
+ * @remarks For details about available filters, refer to {@link TweetFilter}
138
+ *
103
139
  * @public
104
140
  */
105
141
  TweetService.prototype.search = function (query, count, cursor) {
@@ -129,6 +165,23 @@ var TweetService = /** @class */ (function (_super) {
129
165
  * @param cursor - The cursor to the batch of tweets to fetch.
130
166
  * @returns The list tweets present in the given list.
131
167
  *
168
+ * @example
169
+ * ```
170
+ * import { Rettiwt } from 'rettiwt-api';
171
+ *
172
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
173
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
174
+ *
175
+ * // Fetching the most recent 100 tweets of the Twitter list with id '12345678'
176
+ * rettiwt.tweet.list('12345678')
177
+ * .then(res => {
178
+ * console.log(res);
179
+ * })
180
+ * .catch(err => {
181
+ * console.log(err);
182
+ * });
183
+ * ```
184
+ *
132
185
  * @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
133
186
  */
134
187
  TweetService.prototype.list = function (listId, count, cursor) {
@@ -158,6 +211,23 @@ var TweetService = /** @class */ (function (_super) {
158
211
  * @param cursor - The cursor to the batch of favoriters to fetch.
159
212
  * @returns The list of users who liked the given tweet.
160
213
  *
214
+ * @example
215
+ * ```
216
+ * import { Rettiwt } from 'rettiwt-api';
217
+ *
218
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
219
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
220
+ *
221
+ * // Fetching the most recent 100 likers of the Tweet with id '12345678'
222
+ * rettiwt.tweet.favoriters('12345678')
223
+ * .then(res => {
224
+ * console.log(res);
225
+ * })
226
+ * .catch(err => {
227
+ * console.log(err);
228
+ * });
229
+ * ```
230
+ *
161
231
  * @public
162
232
  */
163
233
  TweetService.prototype.favoriters = function (tweetId, count, cursor) {
@@ -185,6 +255,23 @@ var TweetService = /** @class */ (function (_super) {
185
255
  * @param cursor - The cursor to the batch of retweeters to fetch.
186
256
  * @returns The list of users who retweeted the given tweet.
187
257
  *
258
+ * @example
259
+ * ```
260
+ * import { Rettiwt } from 'rettiwt-api';
261
+ *
262
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
263
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
264
+ *
265
+ * // Fetching the most recent 100 retweeters of the Tweet with id '12345678'
266
+ * rettiwt.tweet.retweeters('12345678')
267
+ * .then(res => {
268
+ * console.log(res);
269
+ * })
270
+ * .catch(err => {
271
+ * console.log(err);
272
+ * });
273
+ * ```
274
+ *
188
275
  * @public
189
276
  */
190
277
  TweetService.prototype.retweeters = function (tweetId, count, cursor) {
@@ -210,6 +297,23 @@ var TweetService = /** @class */ (function (_super) {
210
297
  * @param tweetText - The text to be posted, length must be \<= 280 characters.
211
298
  * @returns Whether posting was successful or not.
212
299
  *
300
+ * @example
301
+ * ```
302
+ * import { Rettiwt } from 'rettiwt-api';
303
+ *
304
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
305
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
306
+ *
307
+ * // Posting a tweet to twitter
308
+ * rettiwt.tweet.tweet('Hello World!')
309
+ * .then(res => {
310
+ * console.log(res);
311
+ * })
312
+ * .catch(err => {
313
+ * console.log(err);
314
+ * });
315
+ * ```
316
+ *
213
317
  * @public
214
318
  */
215
319
  TweetService.prototype.tweet = function (tweetText) {
@@ -231,6 +335,23 @@ var TweetService = /** @class */ (function (_super) {
231
335
  * @param tweetId - The id of the tweet to be favorited.
232
336
  * @returns Whether favoriting was successful or not.
233
337
  *
338
+ * @example
339
+ * ```
340
+ * import { Rettiwt } from 'rettiwt-api';
341
+ *
342
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
343
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
344
+ *
345
+ * // Liking the Tweet with id '12345678'
346
+ * rettiwt.tweet.favorite('12345678')
347
+ * .then(res => {
348
+ * console.log(res);
349
+ * })
350
+ * .catch(err => {
351
+ * console.log(err);
352
+ * });
353
+ * ```
354
+ *
234
355
  * @public
235
356
  */
236
357
  TweetService.prototype.favorite = function (tweetId) {
@@ -252,6 +373,23 @@ var TweetService = /** @class */ (function (_super) {
252
373
  * @param tweetId - The id of the tweet with the given id.
253
374
  * @returns Whether retweeting was successful or not.
254
375
  *
376
+ * @example
377
+ * ```
378
+ * import { Rettiwt } from 'rettiwt-api';
379
+ *
380
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
381
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
382
+ *
383
+ * // Retweeting the Tweet with id '12345678'
384
+ * rettiwt.tweet.retweet('12345678')
385
+ * .then(res => {
386
+ * console.log(res);
387
+ * })
388
+ * .catch(err => {
389
+ * console.log(err);
390
+ * });
391
+ * ```
392
+ *
255
393
  * @public
256
394
  */
257
395
  TweetService.prototype.retweet = function (tweetId) {
@@ -1 +1 @@
1
- {"version":3,"file":"TweetService.js","sourceRoot":"","sources":["../../../src/services/public/TweetService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAA0D;AAE1D,WAAW;AACX,6DAA4D;AAQ5D;;;;GAIG;AACH;IAAkC,gCAAc;IAC/C;;;;OAIG;IACH,sBAAmB,MAAsB;eACxC,kBAAM,MAAM,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AC,KAAK,CAAO,4BAAa,CAAC,gBAAgB,EAAE;4BACnE,EAAE,EAAE,OAAO;4BACX,KAAK,EAAE,KAAK;4BACZ,MAAM,EAAE,MAAM;yBACd,CAAC,EAAA;;wBAJI,IAAI,GAAG,SAIX;wBAEF,sBAAO,IAAI,EAAC;;;;KACZ;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,4BAAK,GAAlB,UAAmB,SAAiB;;;;;4BAEtB,qBAAM,IAAI,CAAC,IAAI,CAAC,4BAAa,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAA;;wBAA5E,IAAI,GAAG,SAAqE;wBAElF,sBAAO,IAAI,EAAC;;;;KACZ;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,+BAAQ,GAArB,UAAsB,OAAe;;;;;4BAEvB,qBAAM,IAAI,CAAC,IAAI,CAAC,4BAAa,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAA;;wBAArE,IAAI,GAAG,SAA8D;wBAE3E,sBAAO,IAAI,EAAC;;;;KACZ;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,8BAAO,GAApB,UAAqB,OAAe;;;;;4BAEtB,qBAAM,IAAI,CAAC,IAAI,CAAC,4BAAa,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAA;;wBAArE,IAAI,GAAG,SAA8D;wBAE3E,sBAAO,IAAI,EAAC;;;;KACZ;IACF,mBAAC;AAAD,CAAC,AAzSD,CAAkC,+BAAc,GAyS/C;AAzSY,oCAAY"}
@@ -21,6 +21,40 @@ export declare class UserService extends FetcherService {
21
21
  * @param id - The username/id of the target user.
22
22
  * @returns The details of the given user.
23
23
  *
24
+ * @example Fetching the details of the Twitter user with username 'user1'
25
+ * ```
26
+ * import { Rettiwt } from 'rettiwt-api';
27
+ *
28
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
29
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
30
+ *
31
+ * // Fetching the details of the User with username 'user1'
32
+ * rettiwt.user.details('user1')
33
+ * .then(res => {
34
+ * console.log(res);
35
+ * })
36
+ * .catch(err => {
37
+ * console.log(err);
38
+ * });
39
+ * ```
40
+ *
41
+ * @example Fetching the details of the Twitter user with id '12345678'
42
+ * ```
43
+ * import { Rettiwt } from 'rettiwt-api';
44
+ *
45
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
46
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
47
+ *
48
+ * // Fetching the details of the User with id '12345678'
49
+ * rettiwt.user.details('12345678')
50
+ * .then(res => {
51
+ * console.log(res);
52
+ * })
53
+ * .catch(err => {
54
+ * console.log(err);
55
+ * });
56
+ * ```
57
+ *
24
58
  * @public
25
59
  */
26
60
  details(id: string): Promise<User>;
@@ -32,6 +66,23 @@ export declare class UserService extends FetcherService {
32
66
  * @param cursor - The cursor to the batch of following to fetch.
33
67
  * @returns The list of users followed by the target user.
34
68
  *
69
+ * @example
70
+ * ```
71
+ * import { Rettiwt } from 'rettiwt-api';
72
+ *
73
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
74
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
75
+ *
76
+ * // Fetching the first 100 following of the User with id '12345678'
77
+ * rettiwt.user.following('12345678')
78
+ * .then(res => {
79
+ * console.log(res);
80
+ * })
81
+ * .catch(err => {
82
+ * console.log(err);
83
+ * });
84
+ * ```
85
+ *
35
86
  * @public
36
87
  */
37
88
  following(userId: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
@@ -43,6 +94,23 @@ export declare class UserService extends FetcherService {
43
94
  * @param cursor - The cursor to the batch of followers to fetch.
44
95
  * @returns The list of users following the target user.
45
96
  *
97
+ * @example
98
+ * ```
99
+ * import { Rettiwt } from 'rettiwt-api';
100
+ *
101
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
102
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
103
+ *
104
+ * // Fetching the first 100 followers of the User with id '12345678'
105
+ * rettiwt.user.followers('12345678')
106
+ * .then(res => {
107
+ * console.log(res);
108
+ * })
109
+ * .catch(err => {
110
+ * console.log(err);
111
+ * });
112
+ * ```
113
+ *
46
114
  * @public
47
115
  */
48
116
  followers(userId: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
@@ -54,6 +122,23 @@ export declare class UserService extends FetcherService {
54
122
  * @param cursor - The cursor to the batch of likes to fetch.
55
123
  * @returns The list of tweets liked by the target user.
56
124
  *
125
+ * @example
126
+ * ```
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 most recent 100 liked Tweets of the User with id '12345678'
133
+ * rettiwt.user.likes('12345678')
134
+ * .then(res => {
135
+ * console.log(res);
136
+ * })
137
+ * .catch(err => {
138
+ * console.log(err);
139
+ * });
140
+ * ```
141
+ *
57
142
  * @public
58
143
  */
59
144
  likes(userId: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
@@ -65,6 +150,23 @@ export declare class UserService extends FetcherService {
65
150
  * @param cursor - The cursor to the batch of timeline items to fetch.
66
151
  * @returns The timeline of the target user.
67
152
  *
153
+ * @example
154
+ * ```
155
+ * import { Rettiwt } from 'rettiwt-api';
156
+ *
157
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
158
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
159
+ *
160
+ * // Fetching the first 20 timeline tweets of the User with id '12345678'
161
+ * rettiwt.user.timeline('12345678')
162
+ * .then(res => {
163
+ * console.log(res);
164
+ * })
165
+ * .catch(err => {
166
+ * console.log(err);
167
+ * });
168
+ * ```
169
+ *
68
170
  * @remarks
69
171
  * - If the target user has a pinned tweet, the returned timeline has one item extra and this is always the pinned tweet.
70
172
  * - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
@@ -80,6 +182,23 @@ export declare class UserService extends FetcherService {
80
182
  * @param cursor - The cursor to the batch of replies to fetch.
81
183
  * @returns The reply timeline of the target user.
82
184
  *
185
+ * @example
186
+ * ```
187
+ * import { Rettiwt } from 'rettiwt-api';
188
+ *
189
+ * // Creating a new Rettiwt instance using the given 'API_KEY'
190
+ * const rettiwt = new Rettiwt({ apiKey: API_KEY });
191
+ *
192
+ * // Fetching the first 100 timeline replies of the User with id '12345678'
193
+ * rettiwt.user.replies('12345678')
194
+ * .then(res => {
195
+ * console.log(res);
196
+ * })
197
+ * .catch(err => {
198
+ * console.log(err);
199
+ * });
200
+ * ```
201
+ *
83
202
  * @remarks If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
84
203
  *
85
204
  * @public