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
@@ -13,14 +13,15 @@ export declare class ListService extends FetcherService {
13
13
  /**
14
14
  * Get the list of members of a tweet list.
15
15
  *
16
- * @param id - The id of target list.
16
+ * @param id - The ID of target list.
17
17
  * @param count - The number of members to fetch, must be \<= 100.
18
18
  * @param cursor - The cursor to the batch of members to fetch.
19
19
  *
20
20
  * @returns The list tweets in the given list.
21
21
  *
22
22
  * @example
23
- * ```
23
+ *
24
+ * ```ts
24
25
  * import { Rettiwt } from 'rettiwt-api';
25
26
  *
26
27
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -42,14 +43,15 @@ export declare class ListService extends FetcherService {
42
43
  /**
43
44
  * Get the list of tweets from a tweet list.
44
45
  *
45
- * @param id - The id of target list.
46
+ * @param id - The ID of target list.
46
47
  * @param count - The number of tweets to fetch, must be \<= 100.
47
48
  * @param cursor - The cursor to the batch of tweets to fetch.
48
49
  *
49
50
  * @returns The list tweets in the given list.
50
51
  *
51
52
  * @example
52
- * ```
53
+ *
54
+ * ```ts
53
55
  * import { Rettiwt } from 'rettiwt-api';
54
56
  *
55
57
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -16,14 +16,15 @@ class ListService extends FetcherService_1.FetcherService {
16
16
  /**
17
17
  * Get the list of members of a tweet list.
18
18
  *
19
- * @param id - The id of target list.
19
+ * @param id - The ID of target list.
20
20
  * @param count - The number of members to fetch, must be \<= 100.
21
21
  * @param cursor - The cursor to the batch of members to fetch.
22
22
  *
23
23
  * @returns The list tweets in the given list.
24
24
  *
25
25
  * @example
26
- * ```
26
+ *
27
+ * ```ts
27
28
  * import { Rettiwt } from 'rettiwt-api';
28
29
  *
29
30
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -56,14 +57,15 @@ class ListService extends FetcherService_1.FetcherService {
56
57
  /**
57
58
  * Get the list of tweets from a tweet list.
58
59
  *
59
- * @param id - The id of target list.
60
+ * @param id - The ID of target list.
60
61
  * @param count - The number of tweets to fetch, must be \<= 100.
61
62
  * @param cursor - The cursor to the batch of tweets to fetch.
62
63
  *
63
64
  * @returns The list tweets in the given list.
64
65
  *
65
66
  * @example
66
- * ```
67
+ *
68
+ * ```ts
67
69
  * import { Rettiwt } from 'rettiwt-api';
68
70
  *
69
71
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -1 +1 @@
1
- {"version":3,"file":"ListService.js","sourceRoot":"","sources":["../../../src/services/public/ListService.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAC1D,mDAAqD;AAQrD,qDAAkD;AAElD,MAAa,WAAY,SAAQ,+BAAc;IAC9C;;;;OAIG;IACH,YAAmB,MAAqB;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACI,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,KAAc,EAAE,MAAe;QAC/D,MAAM,QAAQ,GAAkB,wBAAa,CAAC,YAAY,CAAC;QAE3D,mCAAmC;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAuB,QAAQ,EAAE;YACnE,EAAE,EAAE,EAAE;YACN,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;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACI,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAc,EAAE,MAAe;QAC9D,MAAM,QAAQ,GAAG,wBAAa,CAAC,WAAW,CAAC;QAE3C,2BAA2B;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAsB,QAAQ,EAAE;YAClE,EAAE,EAAE,EAAE;YACN,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,oDAAoD;QACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAE5F,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AApGD,kCAoGC"}
1
+ {"version":3,"file":"ListService.js","sourceRoot":"","sources":["../../../src/services/public/ListService.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAC1D,mDAAqD;AAQrD,qDAAkD;AAElD,MAAa,WAAY,SAAQ,+BAAc;IAC9C;;;;OAIG;IACH,YAAmB,MAAqB;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACI,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,KAAc,EAAE,MAAe;QAC/D,MAAM,QAAQ,GAAkB,wBAAa,CAAC,YAAY,CAAC;QAE3D,mCAAmC;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAuB,QAAQ,EAAE;YACnE,EAAE,EAAE,EAAE;YACN,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACI,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAc,EAAE,MAAe;QAC9D,MAAM,QAAQ,GAAG,wBAAa,CAAC,WAAW,CAAC;QAE3C,2BAA2B;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAsB,QAAQ,EAAE;YAClE,EAAE,EAAE,EAAE;YACN,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,oDAAoD;QACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAE5F,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAtGD,kCAsGC"}
@@ -1,3 +1,4 @@
1
+ import { ETweetRepliesSortType } from '../../enums/Tweet';
1
2
  import { CursoredData } from '../../models/data/CursoredData';
2
3
  import { Tweet } from '../../models/data/Tweet';
3
4
  import { User } from '../../models/data/User';
@@ -18,16 +19,21 @@ export declare class TweetService extends FetcherService {
18
19
  */
19
20
  constructor(config: RettiwtConfig);
20
21
  /**
21
- * Get the details of a tweet.
22
+ * Get the details of one or more tweets.
22
23
  *
23
- * @param id - The id(s) of the target tweet/tweets.
24
+ * @param id - The ID/IDs of the target tweet/tweets.
24
25
  *
25
26
  * @returns
26
- * The details of the tweet with the given id.
27
- * If no tweet matches the given id, returns `undefined`.
27
+ * The details of the tweet with the given ID.
28
+ *
29
+ * If more than one ID is provided, returns a list.
30
+ *
31
+ * If no tweet/tweets matches the given ID/IDs, returns `undefined`/`[]`.
28
32
  *
29
33
  * @example
30
- * ```
34
+ *
35
+ * #### Fetching the details of a single tweet
36
+ * ```ts
31
37
  * import { Rettiwt } from 'rettiwt-api';
32
38
  *
33
39
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -36,57 +42,50 @@ export declare class TweetService extends FetcherService {
36
42
  * // Fetching the details of the tweet with the id '1234567890'
37
43
  * rettiwt.tweet.details('1234567890')
38
44
  * .then(res => {
39
- * console.log(res);
45
+ * console.log(res); # 'res' is a single tweet
40
46
  * })
41
47
  * .catch(err => {
42
48
  * console.log(err);
43
49
  * });
44
50
  * ```
45
- */
46
- details<T extends string | string[]>(id: T): Promise<T extends string ? Tweet | undefined : Tweet[]>;
47
- /**
48
- * Like a tweet.
49
- *
50
- * @param id - The id of the tweet to be liked.
51
- *
52
- * @returns Whether liking was successful or not.
53
51
  *
54
52
  * @example
55
- * ```
53
+ *
54
+ * #### Fetching the details of multiple tweets
55
+ * ```ts
56
56
  * import { Rettiwt } from 'rettiwt-api';
57
57
  *
58
58
  * // Creating a new Rettiwt instance using the given 'API_KEY'
59
59
  * const rettiwt = new Rettiwt({ apiKey: API_KEY });
60
60
  *
61
- * // Liking the Tweet with id '1234567890'
62
- * rettiwt.tweet.like('1234567890')
61
+ * // Fetching the details of the tweets with IDs '123', '456', '789'
62
+ * rettiwt.tweet.details(['123', '456', '789'])
63
63
  * .then(res => {
64
- * console.log(res);
64
+ * console.log(res); # 'res' is an array of tweets
65
65
  * })
66
66
  * .catch(err => {
67
67
  * console.log(err);
68
68
  * });
69
69
  * ```
70
70
  */
71
- like(id: string): Promise<boolean>;
71
+ details<T extends string | string[]>(id: T): Promise<T extends string ? Tweet | undefined : Tweet[]>;
72
72
  /**
73
- * Get the list of users who liked a tweet. Only works for your own tweets.
73
+ * Like a tweet.
74
74
  *
75
- * @param id - The id of the target tweet.
76
- * @param count - The number of likers to fetch, must be \<= 100.
77
- * @param cursor - The cursor to the batch of likers to fetch.
75
+ * @param id - The ID of the tweet to be liked.
78
76
  *
79
- * @returns The list of users who liked the given tweet.
77
+ * @returns Whether liking was successful or not.
80
78
  *
81
79
  * @example
82
- * ```
80
+ *
81
+ * ```ts
83
82
  * import { Rettiwt } from 'rettiwt-api';
84
83
  *
85
84
  * // Creating a new Rettiwt instance using the given 'API_KEY'
86
85
  * const rettiwt = new Rettiwt({ apiKey: API_KEY });
87
86
  *
88
- * // Fetching the most recent 100 likers of the Tweet with id '1234567890'
89
- * rettiwt.tweet.likers('1234567890')
87
+ * // Liking the Tweet with id '1234567890'
88
+ * rettiwt.tweet.like('1234567890')
90
89
  * .then(res => {
91
90
  * console.log(res);
92
91
  * })
@@ -95,25 +94,26 @@ export declare class TweetService extends FetcherService {
95
94
  * });
96
95
  * ```
97
96
  */
98
- likers(id: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
97
+ like(id: string): Promise<boolean>;
99
98
  /**
100
- * Get the list of tweets from a tweet list.
99
+ * Get the list of users who liked a tweet. Only works for your own tweets.
101
100
  *
102
- * @param id - The id of target list.
103
- * @param count - The number of tweets to fetch, must be \<= 100.
104
- * @param cursor - The cursor to the batch of tweets to fetch.
101
+ * @param id - The ID of the target tweet.
102
+ * @param count - The number of likers to fetch, must be \<= 100.
103
+ * @param cursor - The cursor to the batch of likers to fetch.
105
104
  *
106
- * @returns The list tweets in the given list.
105
+ * @returns The list of users who liked the given tweet.
107
106
  *
108
107
  * @example
109
- * ```
108
+ *
109
+ * ```ts
110
110
  * import { Rettiwt } from 'rettiwt-api';
111
111
  *
112
112
  * // Creating a new Rettiwt instance using the given 'API_KEY'
113
113
  * const rettiwt = new Rettiwt({ apiKey: API_KEY });
114
114
  *
115
- * // Fetching the most recent 100 tweets of the Twitter list with id '1234567890'
116
- * rettiwt.tweet.list('1234567890')
115
+ * // Fetching the most recent 100 likers of the Tweet with id '1234567890'
116
+ * rettiwt.tweet.likers('1234567890')
117
117
  * .then(res => {
118
118
  * console.log(res);
119
119
  * })
@@ -121,20 +121,19 @@ export declare class TweetService extends FetcherService {
121
121
  * console.log(err);
122
122
  * });
123
123
  * ```
124
- *
125
- * @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
126
124
  */
127
- list(id: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
125
+ likers(id: string, count?: number, cursor?: string): Promise<CursoredData<User>>;
128
126
  /**
129
127
  * Post a tweet.
130
128
  *
131
129
  * @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
132
130
  *
133
- * @returns The id of the posted tweet.
131
+ * @returns The ID of the posted tweet.
134
132
  *
135
133
  * @example
136
- * Posting a simple text
137
- * ```
134
+ *
135
+ * #### Posting a simple text
136
+ * ```ts
138
137
  * import { Rettiwt } from 'rettiwt-api';
139
138
  *
140
139
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -151,14 +150,15 @@ export declare class TweetService extends FetcherService {
151
150
  * ```
152
151
  *
153
152
  * @example
154
- * Posting a tweet with an image that has been already uploaded
155
- * ```
153
+ *
154
+ * #### Posting a tweet with an image that has been already uploaded
155
+ * ```ts
156
156
  * import { Rettiwt } from 'rettiwt-api';
157
157
  *
158
158
  * // Creating a new Rettiwt instance using the given 'API_KEY'
159
159
  * const rettiwt = new Rettiwt({ apiKey: API_KEY });
160
160
  *
161
- * // Posting a tweet, containing an image called 'mountains.jpg', to twitter
161
+ * // Posting a tweet, containing an image with ID '1234567890', to twitter
162
162
  * rettiwt.tweet.post({ text: 'What a nice view!', media: [{ id: '1234567890' }] })
163
163
  * .then(res => {
164
164
  * console.log(res);
@@ -169,8 +169,9 @@ export declare class TweetService extends FetcherService {
169
169
  * ```
170
170
  *
171
171
  * @example
172
- * Posting a reply to a tweet
173
- * ```
172
+ *
173
+ * #### Posting a reply to a tweet
174
+ * ```ts
174
175
  * import { Rettiwt } from 'rettiwt-api';
175
176
  *
176
177
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -186,9 +187,10 @@ export declare class TweetService extends FetcherService {
186
187
  * });
187
188
  * ```
188
189
  *
189
- * * @example
190
- * Posting a tweet that quotes another tweet
191
- * ```
190
+ * @example
191
+ *
192
+ * #### Posting a tweet that quotes another tweet
193
+ * ```ts
192
194
  * import { Rettiwt } from 'rettiwt-api';
193
195
  *
194
196
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -208,13 +210,15 @@ export declare class TweetService extends FetcherService {
208
210
  /**
209
211
  * Get the list of replies to a tweet.
210
212
  *
211
- * @param id - The id of the target tweet.
213
+ * @param id - The ID of the target tweet.
212
214
  * @param cursor - The cursor to the batch of replies to fetch.
215
+ * @param sortBy - The sorting order of the replies to fetch. Default is {@link ETweetRepliesSortType.RECENT}.
213
216
  *
214
217
  * @returns The list of replies to the given tweet.
215
218
  *
216
219
  * @example
217
- * ```
220
+ *
221
+ * ```ts
218
222
  * import { Rettiwt } from 'rettiwt-api';
219
223
  *
220
224
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -229,17 +233,22 @@ export declare class TweetService extends FetcherService {
229
233
  * console.log(err);
230
234
  * });
231
235
  * ```
236
+ *
237
+ * @remarks
238
+ *
239
+ * If the given tweet is the start of/part of a thread, the first batch always contains all the tweets in the thread.
232
240
  */
233
- replies(id: string, cursor?: string): Promise<CursoredData<Tweet>>;
241
+ replies(id: string, cursor?: string, sortBy?: ETweetRepliesSortType): Promise<CursoredData<Tweet>>;
234
242
  /**
235
243
  * Retweet a tweet.
236
244
  *
237
- * @param id - The id of the target tweet.
245
+ * @param id - The ID of the target tweet.
238
246
  *
239
247
  * @returns Whether retweeting was successful or not.
240
248
  *
241
249
  * @example
242
- * ```
250
+ *
251
+ * ```ts
243
252
  * import { Rettiwt } from 'rettiwt-api';
244
253
  *
245
254
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -259,14 +268,15 @@ export declare class TweetService extends FetcherService {
259
268
  /**
260
269
  * Get the list of users who retweeted a tweet.
261
270
  *
262
- * @param id - The id of the target tweet.
271
+ * @param id - The ID of the target tweet.
263
272
  * @param count - The number of retweeters to fetch, must be \<= 100.
264
273
  * @param cursor - The cursor to the batch of retweeters to fetch.
265
274
  *
266
275
  * @returns The list of users who retweeted the given tweet.
267
276
  *
268
277
  * @example
269
- * ```
278
+ *
279
+ * ```ts
270
280
  * import { Rettiwt } from 'rettiwt-api';
271
281
  *
272
282
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -288,11 +298,12 @@ export declare class TweetService extends FetcherService {
288
298
  *
289
299
  * @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
290
300
  *
291
- * @returns The id of the schedule.
301
+ * @returns The ID of the schedule.
292
302
  *
293
303
  * @example
294
- * Scheduling a simple text
295
- * ```
304
+ *
305
+ * #### Scheduling a simple text
306
+ * ```ts
296
307
  * import { Rettiwt } from 'rettiwt-api';
297
308
  *
298
309
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -309,6 +320,7 @@ export declare class TweetService extends FetcherService {
309
320
  * ```
310
321
  *
311
322
  * @remarks
323
+ *
312
324
  * Scheduling a tweet is similar to {@link post}ing, except that an extra parameter called `scheduleFor` is used.
313
325
  */
314
326
  schedule(options: INewTweet): Promise<string | undefined>;
@@ -323,7 +335,8 @@ export declare class TweetService extends FetcherService {
323
335
  * @returns The list of tweets that match the given filter.
324
336
  *
325
337
  * @example
326
- * ```
338
+ *
339
+ * ```ts
327
340
  * import { Rettiwt } from 'rettiwt-api';
328
341
  *
329
342
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -339,7 +352,9 @@ export declare class TweetService extends FetcherService {
339
352
  * });
340
353
  * ```
341
354
  *
342
- * @remarks For details about available filters, refer to {@link TweetFilter}
355
+ * @remarks
356
+ *
357
+ * For details about available filters, refer to {@link TweetFilter}
343
358
  */
344
359
  search(filter: ITweetFilter, count?: number, cursor?: string): Promise<CursoredData<Tweet>>;
345
360
  /**
@@ -351,7 +366,8 @@ export declare class TweetService extends FetcherService {
351
366
  * @returns An async generator that yields matching tweets as they are found.
352
367
  *
353
368
  * @example
354
- * ```
369
+ *
370
+ * ```ts
355
371
  * import { Rettiwt } from 'rettiwt-api';
356
372
  *
357
373
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -361,7 +377,7 @@ export declare class TweetService extends FetcherService {
361
377
  * async function streamTweets() {
362
378
  * try {
363
379
  * // Awaiting for the tweets returned by the AsyncGenerator returned by the method
364
- * for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] }, 1000)) {
380
+ * for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] }, 5000)) {
365
381
  * console.log(tweet.fullText);
366
382
  * }
367
383
  * }
@@ -378,12 +394,13 @@ export declare class TweetService extends FetcherService {
378
394
  /**
379
395
  * Unlike a tweet.
380
396
  *
381
- * @param id - The id of the target tweet.
397
+ * @param id - The ID of the target tweet.
382
398
  *
383
399
  * @returns Whether unliking was successful or not.
384
400
  *
385
401
  * @example
386
- * ```
402
+ *
403
+ * ```ts
387
404
  * import { Rettiwt } from 'rettiwt-api';
388
405
  *
389
406
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -403,12 +420,13 @@ export declare class TweetService extends FetcherService {
403
420
  /**
404
421
  * Unpost a tweet.
405
422
  *
406
- * @param id - The id of the target tweet.
423
+ * @param id - The ID of the target tweet.
407
424
  *
408
425
  * @returns Whether unposting was successful or not.
409
426
  *
410
427
  * @example
411
- * ```
428
+ *
429
+ * ```ts
412
430
  * import { Rettiwt } from 'rettiwt-api';
413
431
  *
414
432
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -428,12 +446,13 @@ export declare class TweetService extends FetcherService {
428
446
  /**
429
447
  * Unretweet a tweet.
430
448
  *
431
- * @param id - The id of the target tweet.
449
+ * @param id - The ID of the target tweet.
432
450
  *
433
451
  * @returns Whether unretweeting was successful or not.
434
452
  *
435
453
  * @example
436
- * ```
454
+ *
455
+ * ```ts
437
456
  * import { Rettiwt } from 'rettiwt-api';
438
457
  *
439
458
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -453,12 +472,13 @@ export declare class TweetService extends FetcherService {
453
472
  /**
454
473
  * Unschedule a tweet.
455
474
  *
456
- * @param id - The id of the scheduled tweet.
475
+ * @param id - The ID of the scheduled tweet.
457
476
  *
458
477
  * @returns Whether unscheduling was successful or not.
459
478
  *
460
479
  * @example
461
- * ```
480
+ *
481
+ * ```ts
462
482
  * import { Rettiwt } from 'rettiwt-api';
463
483
  *
464
484
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -480,10 +500,11 @@ export declare class TweetService extends FetcherService {
480
500
  *
481
501
  * @param media - The path or ArrayBuffer to the media file to upload.
482
502
  *
483
- * @returns The id of the uploaded media.
503
+ * @returns The ID of the uploaded media.
484
504
  *
485
505
  * @example
486
- * ```
506
+ *
507
+ * ```ts
487
508
  * import { Rettiwt } from 'rettiwt-api';
488
509
  *
489
510
  * // Creating a new Rettiwt instance using the given 'API_KEY'
@@ -500,6 +521,7 @@ export declare class TweetService extends FetcherService {
500
521
  * ```
501
522
  *
502
523
  * @remarks
524
+ *
503
525
  * - The uploaded media exists for 24 hrs within which it can be included in a tweet to be posted.
504
526
  * If not posted in a tweet within this period, the uploaded media is removed.
505
527
  * - Instead of a path to the media, an ArrayBuffer containing the media can also be uploaded.