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
@@ -0,0 +1,288 @@
1
+ export interface ITweetDetailsBulkResponse {
2
+ data: Data;
3
+ }
4
+ export interface Data {
5
+ tweetResult: TweetResult[];
6
+ }
7
+ export interface TweetResult {
8
+ result: Result;
9
+ }
10
+ export interface Result {
11
+ __typename: string;
12
+ rest_id: string;
13
+ core: Core;
14
+ unmention_data: UnmentionData;
15
+ edit_control: EditControl;
16
+ is_translatable: boolean;
17
+ views: Views;
18
+ source: string;
19
+ legacy: Legacy2;
20
+ }
21
+ export interface Core {
22
+ user_results: UserResults;
23
+ }
24
+ export interface UserResults {
25
+ result: Result2;
26
+ }
27
+ export interface Result2 {
28
+ __typename: string;
29
+ id: string;
30
+ rest_id: string;
31
+ affiliates_highlighted_label: AffiliatesHighlightedLabel;
32
+ has_graduated_access: boolean;
33
+ is_blue_verified: boolean;
34
+ profile_image_shape: string;
35
+ legacy: Legacy;
36
+ verified_phone_status: boolean;
37
+ }
38
+ export interface AffiliatesHighlightedLabel {
39
+ }
40
+ export interface Legacy {
41
+ following: boolean;
42
+ can_dm: boolean;
43
+ can_media_tag: boolean;
44
+ created_at: string;
45
+ default_profile: boolean;
46
+ default_profile_image: boolean;
47
+ description: string;
48
+ entities: Entities;
49
+ fast_followers_count: number;
50
+ favourites_count: number;
51
+ followers_count: number;
52
+ friends_count: number;
53
+ has_custom_timelines: boolean;
54
+ is_translator: boolean;
55
+ listed_count: number;
56
+ location: string;
57
+ media_count: number;
58
+ name: string;
59
+ normal_followers_count: number;
60
+ pinned_tweet_ids_str: string[];
61
+ possibly_sensitive: boolean;
62
+ profile_banner_url: string;
63
+ profile_image_url_https: string;
64
+ profile_interstitial_type: string;
65
+ screen_name: string;
66
+ statuses_count: number;
67
+ translator_type: string;
68
+ verified: boolean;
69
+ want_retweets: boolean;
70
+ withheld_in_countries: any[];
71
+ }
72
+ export interface Entities {
73
+ description: Description;
74
+ }
75
+ export interface Description {
76
+ urls: any[];
77
+ }
78
+ export interface UnmentionData {
79
+ }
80
+ export interface EditControl {
81
+ edit_tweet_ids: string[];
82
+ editable_until_msecs: string;
83
+ is_edit_eligible: boolean;
84
+ edits_remaining: string;
85
+ }
86
+ export interface Views {
87
+ count: string;
88
+ state: string;
89
+ }
90
+ export interface Legacy2 {
91
+ bookmark_count: number;
92
+ bookmarked: boolean;
93
+ created_at: string;
94
+ conversation_id_str: string;
95
+ display_text_range: number[];
96
+ entities: Entities2;
97
+ extended_entities: ExtendedEntities;
98
+ favorite_count: number;
99
+ favorited: boolean;
100
+ full_text: string;
101
+ is_quote_status: boolean;
102
+ lang: string;
103
+ possibly_sensitive: boolean;
104
+ possibly_sensitive_editable: boolean;
105
+ quote_count: number;
106
+ reply_count: number;
107
+ retweet_count: number;
108
+ retweeted: boolean;
109
+ user_id_str: string;
110
+ id_str: string;
111
+ }
112
+ export interface Entities2 {
113
+ hashtags: any[];
114
+ media: Medum[];
115
+ symbols: any[];
116
+ timestamps: any[];
117
+ urls: any[];
118
+ user_mentions: any[];
119
+ }
120
+ export interface Medum {
121
+ display_url: string;
122
+ expanded_url: string;
123
+ id_str: string;
124
+ indices: number[];
125
+ media_key: string;
126
+ media_url_https: string;
127
+ type: string;
128
+ url: string;
129
+ ext_media_availability: ExtMediaAvailability;
130
+ features: Features;
131
+ sizes: Sizes;
132
+ original_info: OriginalInfo;
133
+ allow_download_status: AllowDownloadStatus;
134
+ media_results: MediaResults;
135
+ }
136
+ export interface ExtMediaAvailability {
137
+ status: string;
138
+ }
139
+ export interface Features {
140
+ large: Large;
141
+ medium: Medium;
142
+ small: Small;
143
+ orig: Orig;
144
+ }
145
+ export interface Large {
146
+ faces: any[];
147
+ }
148
+ export interface Medium {
149
+ faces: any[];
150
+ }
151
+ export interface Small {
152
+ faces: any[];
153
+ }
154
+ export interface Orig {
155
+ faces: any[];
156
+ }
157
+ export interface Sizes {
158
+ large: Large2;
159
+ medium: Medium2;
160
+ small: Small2;
161
+ thumb: Thumb;
162
+ }
163
+ export interface Large2 {
164
+ h: number;
165
+ w: number;
166
+ resize: string;
167
+ }
168
+ export interface Medium2 {
169
+ h: number;
170
+ w: number;
171
+ resize: string;
172
+ }
173
+ export interface Small2 {
174
+ h: number;
175
+ w: number;
176
+ resize: string;
177
+ }
178
+ export interface Thumb {
179
+ h: number;
180
+ w: number;
181
+ resize: string;
182
+ }
183
+ export interface OriginalInfo {
184
+ height: number;
185
+ width: number;
186
+ focus_rects: FocusRect[];
187
+ }
188
+ export interface FocusRect {
189
+ x: number;
190
+ y: number;
191
+ w: number;
192
+ h: number;
193
+ }
194
+ export interface AllowDownloadStatus {
195
+ allow_download: boolean;
196
+ }
197
+ export interface MediaResults {
198
+ result: Result3;
199
+ }
200
+ export interface Result3 {
201
+ media_key: string;
202
+ }
203
+ export interface ExtendedEntities {
204
+ media: Medum2[];
205
+ }
206
+ export interface Medum2 {
207
+ display_url: string;
208
+ expanded_url: string;
209
+ id_str: string;
210
+ indices: number[];
211
+ media_key: string;
212
+ media_url_https: string;
213
+ type: string;
214
+ url: string;
215
+ ext_media_availability: ExtMediaAvailability2;
216
+ features: Features2;
217
+ sizes: Sizes2;
218
+ original_info: OriginalInfo2;
219
+ allow_download_status: AllowDownloadStatus2;
220
+ media_results: MediaResults2;
221
+ }
222
+ export interface ExtMediaAvailability2 {
223
+ status: string;
224
+ }
225
+ export interface Features2 {
226
+ large: Large3;
227
+ medium: Medium3;
228
+ small: Small3;
229
+ orig: Orig2;
230
+ }
231
+ export interface Large3 {
232
+ faces: any[];
233
+ }
234
+ export interface Medium3 {
235
+ faces: any[];
236
+ }
237
+ export interface Small3 {
238
+ faces: any[];
239
+ }
240
+ export interface Orig2 {
241
+ faces: any[];
242
+ }
243
+ export interface Sizes2 {
244
+ large: Large4;
245
+ medium: Medium4;
246
+ small: Small4;
247
+ thumb: Thumb2;
248
+ }
249
+ export interface Large4 {
250
+ h: number;
251
+ w: number;
252
+ resize: string;
253
+ }
254
+ export interface Medium4 {
255
+ h: number;
256
+ w: number;
257
+ resize: string;
258
+ }
259
+ export interface Small4 {
260
+ h: number;
261
+ w: number;
262
+ resize: string;
263
+ }
264
+ export interface Thumb2 {
265
+ h: number;
266
+ w: number;
267
+ resize: string;
268
+ }
269
+ export interface OriginalInfo2 {
270
+ height: number;
271
+ width: number;
272
+ focus_rects: FocusRect2[];
273
+ }
274
+ export interface FocusRect2 {
275
+ x: number;
276
+ y: number;
277
+ w: number;
278
+ h: number;
279
+ }
280
+ export interface AllowDownloadStatus2 {
281
+ allow_download: boolean;
282
+ }
283
+ export interface MediaResults2 {
284
+ result: Result4;
285
+ }
286
+ export interface Result4 {
287
+ media_key: string;
288
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=DetailsBulk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DetailsBulk.js","sourceRoot":"","sources":["../../../../src/types/raw/tweet/DetailsBulk.ts"],"names":[],"mappings":";AAAA,oBAAoB"}
@@ -0,0 +1,91 @@
1
+ export interface IUserDetailsBulkResponse {
2
+ data: Data;
3
+ }
4
+ export interface Data {
5
+ users: User[];
6
+ }
7
+ export interface User {
8
+ result: Result;
9
+ }
10
+ export interface Result {
11
+ __typename: string;
12
+ id: string;
13
+ rest_id: string;
14
+ affiliates_highlighted_label: AffiliatesHighlightedLabel;
15
+ has_graduated_access: boolean;
16
+ is_blue_verified: boolean;
17
+ profile_image_shape: string;
18
+ legacy: Legacy;
19
+ professional?: Professional;
20
+ super_follow_eligible: boolean;
21
+ super_followed_by: boolean;
22
+ super_following: boolean;
23
+ }
24
+ export interface AffiliatesHighlightedLabel {
25
+ label?: Label;
26
+ }
27
+ export interface Label {
28
+ url: Url;
29
+ badge: Badge;
30
+ description: string;
31
+ userLabelType: string;
32
+ userLabelDisplayType: string;
33
+ }
34
+ export interface Url {
35
+ url: string;
36
+ urlType: string;
37
+ }
38
+ export interface Badge {
39
+ url: string;
40
+ }
41
+ export interface Legacy {
42
+ blocked_by: boolean;
43
+ blocking: boolean;
44
+ follow_request_sent: boolean;
45
+ followed_by: boolean;
46
+ muting: boolean;
47
+ notifications: boolean;
48
+ protected: boolean;
49
+ following: boolean;
50
+ can_dm: boolean;
51
+ can_media_tag: boolean;
52
+ created_at: string;
53
+ default_profile: boolean;
54
+ default_profile_image: boolean;
55
+ description: string;
56
+ entities: Entities;
57
+ fast_followers_count: number;
58
+ favourites_count: number;
59
+ followers_count: number;
60
+ friends_count: number;
61
+ has_custom_timelines: boolean;
62
+ is_translator: boolean;
63
+ listed_count: number;
64
+ location: string;
65
+ media_count: number;
66
+ name: string;
67
+ normal_followers_count: number;
68
+ pinned_tweet_ids_str: any[];
69
+ possibly_sensitive: boolean;
70
+ profile_banner_url?: string;
71
+ profile_image_url_https: string;
72
+ profile_interstitial_type: string;
73
+ screen_name: string;
74
+ statuses_count: number;
75
+ translator_type: string;
76
+ verified: boolean;
77
+ want_retweets: boolean;
78
+ withheld_in_countries: any[];
79
+ needs_phone_verification?: boolean;
80
+ }
81
+ export interface Entities {
82
+ description: Description;
83
+ }
84
+ export interface Description {
85
+ urls: any[];
86
+ }
87
+ export interface Professional {
88
+ rest_id: string;
89
+ professional_type: string;
90
+ category: any[];
91
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=DetailsBulk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DetailsBulk.js","sourceRoot":"","sources":["../../../../src/types/raw/user/DetailsBulk.ts"],"names":[],"mappings":";AAAA,oBAAoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rettiwt-api",
3
- "version": "5.0.0-alpha.3",
3
+ "version": "5.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "An API for fetching data from TwitterAPI, without any rate limits!",
@@ -7,6 +7,7 @@ import { IListMembersResponse } from '../types/raw/list/Members';
7
7
  import { IListTweetsResponse } from '../types/raw/list/Tweets';
8
8
  import { IMediaInitializeUploadResponse } from '../types/raw/media/InitalizeUpload';
9
9
  import { ITweetDetailsResponse } from '../types/raw/tweet/Details';
10
+ import { ITweetDetailsBulkResponse } from '../types/raw/tweet/DetailsBulk';
10
11
  import { ITweetLikeResponse } from '../types/raw/tweet/Like';
11
12
  import { ITweetLikersResponse } from '../types/raw/tweet/Likers';
12
13
  import { ITweetPostResponse } from '../types/raw/tweet/Post';
@@ -19,8 +20,10 @@ import { ITweetUnlikeResponse } from '../types/raw/tweet/Unlike';
19
20
  import { ITweetUnpostResponse } from '../types/raw/tweet/Unpost';
20
21
  import { ITweetUnretweetResponse } from '../types/raw/tweet/Unretweet';
21
22
  import { ITweetUnscheduleResponse } from '../types/raw/tweet/Unschedule';
23
+ import { IUserAffiliatesResponse } from '../types/raw/user/Affiliates';
22
24
  import { IUserBookmarksResponse } from '../types/raw/user/Bookmarks';
23
25
  import { IUserDetailsResponse } from '../types/raw/user/Details';
26
+ import { IUserDetailsBulkResponse } from '../types/raw/user/DetailsBulk';
24
27
  import { IUserFollowResponse } from '../types/raw/user/Follow';
25
28
  import { IUserFollowedResponse } from '../types/raw/user/Followed';
26
29
  import { IUserFollowersResponse } from '../types/raw/user/Followers';
@@ -55,7 +58,7 @@ export const extractors = {
55
58
 
56
59
  TWEET_DETAILS: (response: ITweetDetailsResponse, id: string): Tweet | undefined => Tweet.single(response, id),
57
60
  TWEET_DETAILS_ALT: (response: ITweetRepliesResponse, id: string): Tweet | undefined => Tweet.single(response, id),
58
- TWEET_DETAILS_BULK: (response: NonNullable<unknown>, ids: string[]): Tweet[] => Tweet.multiple(response, ids),
61
+ TWEET_DETAILS_BULK: (response: ITweetDetailsBulkResponse, ids: string[]): Tweet[] => Tweet.multiple(response, ids),
59
62
  TWEET_LIKE: (response: ITweetLikeResponse): boolean => (response?.data?.favorite_tweet ? true : false),
60
63
  TWEET_LIKERS: (response: ITweetLikersResponse): CursoredData<User> =>
61
64
  new CursoredData<User>(response, EBaseType.USER),
@@ -75,11 +78,14 @@ export const extractors = {
75
78
  response?.data?.unretweet?.source_tweet_results?.result ? true : false,
76
79
  TWEET_UNSCHEDULE: (response: ITweetUnscheduleResponse): boolean => response?.data?.scheduledtweet_delete == 'Done',
77
80
 
81
+ USER_AFFILIATES: (response: IUserAffiliatesResponse): CursoredData<User> =>
82
+ new CursoredData<User>(response, EBaseType.USER),
78
83
  USER_BOOKMARKS: (response: IUserBookmarksResponse): CursoredData<Tweet> =>
79
84
  new CursoredData<Tweet>(response, EBaseType.TWEET),
80
85
  USER_DETAILS_BY_USERNAME: (response: IUserDetailsResponse): User | undefined => User.single(response),
81
86
  USER_DETAILS_BY_ID: (response: IUserDetailsResponse): User | undefined => User.single(response),
82
- USER_DETAILS_BY_IDS_BULK: (response: NonNullable<unknown>, ids: string[]): User[] => User.multiple(response, ids),
87
+ USER_DETAILS_BY_IDS_BULK: (response: IUserDetailsBulkResponse, ids: string[]): User[] =>
88
+ User.multiple(response, ids),
83
89
  USER_FEED_FOLLOWED: (response: IUserFollowedResponse): CursoredData<Tweet> =>
84
90
  new CursoredData<Tweet>(response, EBaseType.TWEET),
85
91
  USER_FEED_RECOMMENDED: (response: IUserRecommendedResponse): CursoredData<Tweet> =>
@@ -26,6 +26,7 @@ export const fetchResources = [
26
26
  EResourceType.TWEET_REPLIES,
27
27
  EResourceType.TWEET_RETWEETERS,
28
28
  EResourceType.TWEET_SEARCH,
29
+ EResourceType.USER_AFFILIATES,
29
30
  EResourceType.USER_BOOKMARKS,
30
31
  EResourceType.USER_DETAILS_BY_USERNAME,
31
32
  EResourceType.USER_DETAILS_BY_ID,
@@ -8,8 +8,10 @@ import { UserRequests } from '../requests/User';
8
8
  import { IFetchArgs } from '../types/args/FetchArgs';
9
9
  import { IPostArgs } from '../types/args/PostArgs';
10
10
 
11
+ import { rawTweetRepliesSortType } from './Tweet';
12
+
11
13
  /**
12
- * The collection of requests to various resources.
14
+ * Collection of requests to various resources.
13
15
  *
14
16
  * @internal
15
17
  */
@@ -29,7 +31,8 @@ export const requests: { [key in keyof typeof EResourceType]: (args: IFetchArgs
29
31
  TWEET_LIKE: (args: IPostArgs) => TweetRequests.like(args.id!),
30
32
  TWEET_LIKERS: (args: IFetchArgs) => TweetRequests.likers(args.id!, args.count, args.cursor),
31
33
  TWEET_POST: (args: IPostArgs) => TweetRequests.post(args.tweet!),
32
- TWEET_REPLIES: (args: IFetchArgs) => TweetRequests.replies(args.id!, args.cursor),
34
+ TWEET_REPLIES: (args: IFetchArgs) =>
35
+ TweetRequests.replies(args.id!, args.cursor, args.sortBy ? rawTweetRepliesSortType[args.sortBy] : undefined),
33
36
  TWEET_RETWEET: (args: IPostArgs) => TweetRequests.retweet(args.id!),
34
37
  TWEET_RETWEETERS: (args: IFetchArgs) => TweetRequests.retweeters(args.id!, args.count, args.cursor),
35
38
  TWEET_SCHEDULE: (args: IPostArgs) => TweetRequests.schedule(args.tweet!),
@@ -39,6 +42,7 @@ export const requests: { [key in keyof typeof EResourceType]: (args: IFetchArgs
39
42
  TWEET_UNRETWEET: (args: IPostArgs) => TweetRequests.unretweet(args.id!),
40
43
  TWEET_UNSCHEDULE: (args: IPostArgs) => TweetRequests.unschedule(args.id!),
41
44
 
45
+ USER_AFFILIATES: (args: IFetchArgs) => UserRequests.affiliates(args.id!, args.count, args.cursor),
42
46
  USER_BOOKMARKS: (args: IFetchArgs) => UserRequests.bookmarks(args.count, args.cursor),
43
47
  USER_DETAILS_BY_USERNAME: (args: IFetchArgs) => UserRequests.detailsByUsername(args.id!),
44
48
  USER_DETAILS_BY_ID: (args: IFetchArgs) => UserRequests.detailsById(args.id!),
@@ -0,0 +1,17 @@
1
+ import { ERawTweetRepliesSortType } from '../enums/raw/Tweet';
2
+ import { ETweetRepliesSortType } from '../enums/Tweet';
3
+
4
+ /**
5
+ * Collection of mapping from parsed reply sort type to raw reply sort type.
6
+ *
7
+ * @internal
8
+ */
9
+ export const rawTweetRepliesSortType: { [key in keyof typeof ETweetRepliesSortType]: ERawTweetRepliesSortType } = {
10
+ /* eslint-disable @typescript-eslint/naming-convention */
11
+
12
+ LATEST: ERawTweetRepliesSortType.LATEST,
13
+ LIKES: ERawTweetRepliesSortType.LIKES,
14
+ RELEVANCE: ERawTweetRepliesSortType.RELEVACE,
15
+
16
+ /* eslint-enable @typescript-eslint/naming-convention */
17
+ };
@@ -70,22 +70,6 @@ function createTweetCommand(rettiwt: Rettiwt): Command {
70
70
  }
71
71
  });
72
72
 
73
- // List
74
- tweet
75
- .command('list')
76
- .description('Fetch the list of tweets in the tweet list with the given id')
77
- .argument('<id>', 'The id of the tweet list')
78
- .argument('[count]', 'The number of tweets to fetch')
79
- .argument('[cursor]', 'The cursor to the batch of tweets to fetch')
80
- .action(async (id: string, count?: string, cursor?: string) => {
81
- try {
82
- const tweets = await rettiwt.tweet.list(id, count ? parseInt(count) : undefined, cursor);
83
- output(tweets);
84
- } catch (error) {
85
- output(error);
86
- }
87
- });
88
-
89
73
  // Post
90
74
  tweet
91
75
  .command('post')
@@ -13,6 +13,21 @@ function createUserCommand(rettiwt: Rettiwt): Command {
13
13
  // Creating the 'user' command
14
14
  const user = createCommand('user').description('Access resources releated to users');
15
15
 
16
+ // Affiliates
17
+ user.command('affiliates')
18
+ .description('Fetch the list of users who affiliated to the given user')
19
+ .argument('<id>', 'The id of the user')
20
+ .argument('[count]', 'The number of affiliates to fetch')
21
+ .argument('[cursor]', 'The cursor to the batch of affiliates to fetch')
22
+ .action(async (id: string, count?: string, cursor?: string) => {
23
+ try {
24
+ const users = await rettiwt.user.affiliates(id, count ? parseInt(count) : undefined, cursor);
25
+ output(users);
26
+ } catch (error) {
27
+ output(error);
28
+ }
29
+ });
30
+
16
31
  user.command('bookmarks')
17
32
  .description('Fetch your list of bookmarks')
18
33
  .argument('[count]', 'The number of bookmarks to fetch')
@@ -178,21 +193,6 @@ function createUserCommand(rettiwt: Rettiwt): Command {
178
193
  }
179
194
  });
180
195
 
181
- // Subscriptions
182
- user.command('subscriptions')
183
- .description('Fetch the list of users who are subscribed by the given user')
184
- .argument('<id>', 'The id of the user')
185
- .argument('[count]', 'The number of subscriptions to fetch')
186
- .argument('[cursor]', 'The cursor to the batch of subscriptions to fetch')
187
- .action(async (id: string, count?: string, cursor?: string) => {
188
- try {
189
- const users = await rettiwt.user.subscriptions(id, count ? parseInt(count) : undefined, cursor);
190
- output(users);
191
- } catch (error) {
192
- output(error);
193
- }
194
- });
195
-
196
196
  // Timeline
197
197
  user.command('timeline')
198
198
  .description('Fetch the tweets timeline the given user')
package/src/enums/Api.ts CHANGED
@@ -5,57 +5,6 @@
5
5
  */
6
6
  export enum EApiErrors {
7
7
  COULD_NOT_AUTHENTICATE = 'Failed to authenticate',
8
- RESOURCE_NOT_FOUND = 'Requested resource not found',
9
- MISSING_PARAMETER = 'Missing named parameter',
10
- USER_NOT_FOUND = 'Requested user not found',
11
- USER_SUSPENDED = 'Requested user has been suspended',
12
- ACCOUNT_SUSPENDED = 'Account has been suspended',
13
- RATE_LIMIT_EXCEEDED = 'Rate limit exceeded',
14
- INTERNAL_ERROR = 'Internal server error',
15
- TIME_ERROR = 'Mismatched data/time with server',
16
- ALREADY_FAVORITED = 'Tweet already favorited',
17
- STATUS_NOT_FOUND = 'Requested tweeet not found',
18
- NOT_AUTHORIZED = 'Not authorized to view tweet',
19
- DAILY_STATUS_LIMIT_EXCEEDED = 'Exceeded daily tweet update limit',
20
- TWEET_LENGTH_EXCEEDED = 'Exceeded tweet text maximum length',
21
- DUPLICATE_STATUS = 'Tweet already posted',
22
8
  BAD_AUTHENTICATION = 'Invalid authentication data',
23
9
  RESOURCE_NOT_ALLOWED = 'Not authorized to access requested resource',
24
- AUTOMATED_REQUEST_ERROR = 'Automated request detected',
25
- ACCOUNT_LOCKED = 'Account has been locked',
26
- ALREADY_RETWEETED = 'Tweet already retweeted',
27
- TWEET_NOT_FOUND = 'Requested tweet not found',
28
- TWEET_VIOLATED_RULES = 'Requestd tweet has been removed for rules violation',
29
- DISABLED_TWEET_ACTIONS = 'Reqeusted action disabled on the tweet',
30
- }
31
-
32
- /**
33
- * The different error codes.
34
- *
35
- * @public
36
- */
37
- export enum EErrorCodes {
38
- COULD_NOT_AUTHENTICATE = 32,
39
- RESOURCE_NOT_FOUND = 34,
40
- MISSING_PARAMETER = 38,
41
- USER_NOT_FOUND = 50,
42
- USER_SUSPENDED = 63,
43
- ACCOUNT_SUSPENDED = 64,
44
- RATE_LIMIT_EXCEEDED = 88,
45
- INTERNAL_ERROR = 131,
46
- TIME_ERROR = 135,
47
- ALREADY_FAVORITED = 139,
48
- STATUS_NOT_FOUND = 144,
49
- NOT_AUTHORIZED = 179,
50
- DAILY_STATUS_LIMIT_EXCEEDED = 185,
51
- TWEET_LENGTH_EXCEEDED = 186,
52
- DUPLICATE_STATUS = 187,
53
- BAD_AUTHENTICATION = 215,
54
- RESOURCE_NOT_ALLOWED = 220,
55
- AUTOMATED_REQUEST_ERROR = 226,
56
- ACCOUNT_LOCKED = 326,
57
- ALREADY_RETWEETED = 327,
58
- TWEET_NOT_FOUND = 421,
59
- TWEET_VIOLATED_RULES = 422,
60
- DISABLED_TWEET_ACTIONS = 425,
61
10
  }
@@ -31,6 +31,7 @@ export enum EResourceType {
31
31
  TWEET_UNSCHEDULE = 'TWEET_UNSCHEDULE',
32
32
 
33
33
  // USER
34
+ USER_AFFILIATES = 'USER_AFFILIATES',
34
35
  USER_BOOKMARKS = 'USER_BOOKMARKS',
35
36
  USER_DETAILS_BY_USERNAME = 'USER_DETAILS_BY_USERNAME',
36
37
  USER_DETAILS_BY_ID = 'USER_DETAILS_BY_ID',
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The different types of sorting options when fetching replies to tweets.
3
+ */
4
+ export enum ETweetRepliesSortType {
5
+ LIKES = 'LIKES',
6
+ LATEST = 'LATEST',
7
+ RELEVANCE = 'RELEVANCE',
8
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The different types of search results when searching for Tweets.
2
+ * The different types of search results when searching for tweets.
3
3
  *
4
4
  * @public
5
5
  */
@@ -7,3 +7,14 @@ export enum ERawTweetSearchResultType {
7
7
  LATEST = 'Latest',
8
8
  TOP = 'Top',
9
9
  }
10
+
11
+ /**
12
+ * The different types of sorting options when fetching replies to tweets.
13
+ *
14
+ * @public
15
+ */
16
+ export enum ERawTweetRepliesSortType {
17
+ RELEVACE = 'Relevance',
18
+ LATEST = 'Recency',
19
+ LIKES = 'Likes',
20
+ }