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.
- package/README.md +160 -87
- package/dist/collections/Extractors.d.ts +6 -2
- package/dist/collections/Extractors.js +1 -0
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.js +1 -0
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.d.ts +1 -1
- package/dist/collections/Requests.js +4 -2
- package/dist/collections/Requests.js.map +1 -1
- package/dist/collections/Tweet.d.ts +10 -0
- package/dist/collections/Tweet.js +17 -0
- package/dist/collections/Tweet.js.map +1 -0
- package/dist/commands/Tweet.js +0 -16
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +15 -15
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Api.d.ts +1 -51
- package/dist/enums/Api.js +1 -52
- package/dist/enums/Api.js.map +1 -1
- package/dist/enums/Resource.d.ts +1 -0
- package/dist/enums/Resource.js +1 -0
- package/dist/enums/Resource.js.map +1 -1
- package/dist/enums/Tweet.d.ts +8 -0
- package/dist/enums/Tweet.js +13 -0
- package/dist/enums/Tweet.js.map +1 -0
- package/dist/enums/raw/Tweet.d.ts +11 -1
- package/dist/enums/raw/Tweet.js +13 -2
- package/dist/enums/raw/Tweet.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/models/RettiwtConfig.d.ts +27 -3
- package/dist/models/RettiwtConfig.js +37 -4
- package/dist/models/RettiwtConfig.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +3 -3
- package/dist/models/args/FetchArgs.js +3 -2
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/args/PostArgs.d.ts +2 -3
- package/dist/models/args/PostArgs.js +3 -3
- package/dist/models/args/PostArgs.js.map +1 -1
- package/dist/models/auth/AuthCookie.d.ts +1 -1
- package/dist/models/auth/AuthCookie.js +1 -1
- package/dist/models/auth/AuthCredential.d.ts +1 -1
- package/dist/models/auth/AuthCredential.js +1 -1
- package/dist/models/data/List.d.ts +4 -0
- package/dist/models/data/List.js +7 -0
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Notification.d.ts +4 -0
- package/dist/models/data/Notification.js +7 -0
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +4 -0
- package/dist/models/data/Tweet.js +7 -0
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +4 -0
- package/dist/models/data/User.js +7 -0
- package/dist/models/data/User.js.map +1 -1
- package/dist/models/errors/TwitterError.d.ts +37 -0
- package/dist/models/errors/TwitterError.js +60 -0
- package/dist/models/errors/TwitterError.js.map +1 -0
- package/dist/requests/List.js +28 -9
- package/dist/requests/List.js.map +1 -1
- package/dist/requests/Tweet.d.ts +2 -1
- package/dist/requests/Tweet.js +94 -38
- package/dist/requests/Tweet.js.map +1 -1
- package/dist/requests/User.js +231 -111
- package/dist/requests/User.js.map +1 -1
- package/dist/services/internal/AuthService.d.ts +6 -6
- package/dist/services/internal/AuthService.js +7 -8
- package/dist/services/internal/AuthService.js.map +1 -1
- package/dist/services/internal/ErrorService.d.ts +5 -76
- package/dist/services/internal/ErrorService.js +13 -116
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/TidService.d.ts +4 -5
- package/dist/services/internal/TidService.js +18 -24
- package/dist/services/internal/TidService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +4 -3
- package/dist/services/public/FetcherService.js +8 -7
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.d.ts +6 -4
- package/dist/services/public/ListService.js +6 -4
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +96 -74
- package/dist/services/public/TweetService.js +97 -87
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +106 -38
- package/dist/services/public/UserService.js +126 -43
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/args/FetchArgs.d.ts +8 -0
- package/dist/types/errors/TwitterError.d.ts +30 -0
- package/dist/types/{raw/generic/Error.js → errors/TwitterError.js} +1 -1
- package/dist/types/errors/TwitterError.js.map +1 -0
- package/dist/types/raw/base/Error.d.ts +32 -0
- package/dist/types/raw/base/Error.js +4 -0
- package/dist/types/raw/base/Error.js.map +1 -0
- package/dist/types/raw/generic/Response.d.ts +0 -2
- package/dist/types/raw/tweet/DetailsBulk.d.ts +288 -0
- package/dist/types/raw/tweet/DetailsBulk.js +4 -0
- package/dist/types/raw/tweet/DetailsBulk.js.map +1 -0
- package/dist/types/raw/user/DetailsBulk.d.ts +91 -0
- package/dist/types/raw/user/DetailsBulk.js +4 -0
- package/dist/types/raw/user/DetailsBulk.js.map +1 -0
- package/package.json +1 -1
- package/src/collections/Extractors.ts +8 -2
- package/src/collections/Groups.ts +1 -0
- package/src/collections/Requests.ts +6 -2
- package/src/collections/Tweet.ts +17 -0
- package/src/commands/Tweet.ts +0 -16
- package/src/commands/User.ts +15 -15
- package/src/enums/Api.ts +0 -51
- package/src/enums/Resource.ts +1 -0
- package/src/enums/Tweet.ts +8 -0
- package/src/enums/raw/Tweet.ts +12 -1
- package/src/index.ts +6 -6
- package/src/models/RettiwtConfig.ts +43 -4
- package/src/models/args/FetchArgs.ts +4 -3
- package/src/models/args/PostArgs.ts +3 -4
- package/src/models/auth/AuthCookie.ts +1 -1
- package/src/models/auth/AuthCredential.ts +1 -1
- package/src/models/data/List.ts +9 -0
- package/src/models/data/Notification.ts +10 -0
- package/src/models/data/Tweet.ts +9 -0
- package/src/models/data/User.ts +9 -0
- package/src/models/errors/TwitterError.ts +65 -0
- package/src/requests/List.ts +28 -9
- package/src/requests/Tweet.ts +95 -39
- package/src/requests/User.ts +231 -111
- package/src/services/internal/AuthService.ts +8 -9
- package/src/services/internal/ErrorService.ts +14 -132
- package/src/services/internal/TidService.ts +21 -28
- package/src/services/public/FetcherService.ts +8 -7
- package/src/services/public/ListService.ts +6 -4
- package/src/services/public/TweetService.ts +104 -95
- package/src/services/public/UserService.ts +143 -51
- package/src/types/args/FetchArgs.ts +10 -0
- package/src/types/errors/TwitterError.ts +37 -0
- package/src/types/raw/base/Error.ts +37 -0
- package/src/types/raw/generic/Response.ts +0 -3
- package/src/types/raw/tweet/DetailsBulk.ts +338 -0
- package/src/types/raw/user/DetailsBulk.ts +104 -0
- package/dist/enums/Http.d.ts +0 -68
- package/dist/enums/Http.js +0 -73
- package/dist/enums/Http.js.map +0 -1
- package/dist/models/errors/ApiError.d.ts +0 -15
- package/dist/models/errors/ApiError.js +0 -23
- package/dist/models/errors/ApiError.js.map +0 -1
- package/dist/models/errors/HttpError.d.ts +0 -15
- package/dist/models/errors/HttpError.js +0 -23
- package/dist/models/errors/HttpError.js.map +0 -1
- package/dist/models/errors/RettiwtError.d.ts +0 -9
- package/dist/models/errors/RettiwtError.js +0 -17
- package/dist/models/errors/RettiwtError.js.map +0 -1
- package/dist/models/errors/TimeoutError.d.ts +0 -12
- package/dist/models/errors/TimeoutError.js +0 -19
- package/dist/models/errors/TimeoutError.js.map +0 -1
- package/dist/types/raw/generic/Error.d.ts +0 -30
- package/dist/types/raw/generic/Error.js.map +0 -1
- package/src/enums/Http.ts +0 -68
- package/src/models/errors/ApiError.ts +0 -21
- package/src/models/errors/HttpError.ts +0 -21
- package/src/models/errors/RettiwtError.ts +0 -13
- package/src/models/errors/TimeoutError.ts +0 -15
- package/src/types/raw/generic/Error.ts +0 -35
|
@@ -18,6 +18,45 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
18
18
|
constructor(config) {
|
|
19
19
|
super(config);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the list affiliates of a user.
|
|
23
|
+
*
|
|
24
|
+
* @param id - The ID of the target user. If no id is provided, the logged-in user's id is used.
|
|
25
|
+
* @param count - The number of affiliates to fetch, must be \<= 100.
|
|
26
|
+
* @param cursor - The cursor to the batch of affiliates to fetch.
|
|
27
|
+
*
|
|
28
|
+
* @returns The list of users affiliated to the target user.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
34
|
+
*
|
|
35
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
36
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
37
|
+
*
|
|
38
|
+
* // Fetching the first 100 affiliates of the User with id '1234567890'
|
|
39
|
+
* rettiwt.user.affiliates('1234567890')
|
|
40
|
+
* .then(res => {
|
|
41
|
+
* console.log(res);
|
|
42
|
+
* })
|
|
43
|
+
* .catch(err => {
|
|
44
|
+
* console.log(err);
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
async affiliates(id, count, cursor) {
|
|
49
|
+
const resource = Resource_1.EResourceType.USER_AFFILIATES;
|
|
50
|
+
// Fetching raw list of affiliates
|
|
51
|
+
const response = await this.request(resource, {
|
|
52
|
+
id: id ?? this.config.userId,
|
|
53
|
+
count: count,
|
|
54
|
+
cursor: cursor,
|
|
55
|
+
});
|
|
56
|
+
// Deserializing response
|
|
57
|
+
const data = Extractors_1.extractors[resource](response);
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
21
60
|
/**
|
|
22
61
|
* Get the list of bookmarks of the logged in user.
|
|
23
62
|
*
|
|
@@ -27,7 +66,8 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
27
66
|
* @returns The list of tweets bookmarked by the target user.
|
|
28
67
|
*
|
|
29
68
|
* @example
|
|
30
|
-
*
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
31
71
|
* import { Rettiwt } from 'rettiwt-api';
|
|
32
72
|
*
|
|
33
73
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -57,15 +97,19 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
57
97
|
/**
|
|
58
98
|
* Get the details of a user.
|
|
59
99
|
*
|
|
60
|
-
* @param id - The username/
|
|
100
|
+
* @param id - The username/ID/IDs of the target user/users. If no ID is provided, the logged-in user's ID is used.
|
|
61
101
|
*
|
|
62
102
|
* @returns
|
|
63
103
|
* The details of the given user.
|
|
104
|
+
*
|
|
105
|
+
* If more than one ID is provided, returns a list.
|
|
106
|
+
*
|
|
64
107
|
* If no user matches the given id, returns `undefined`.
|
|
65
108
|
*
|
|
66
109
|
* @example
|
|
67
|
-
*
|
|
68
|
-
*
|
|
110
|
+
*
|
|
111
|
+
* #### Fetching the details of a single user using username
|
|
112
|
+
* ```ts
|
|
69
113
|
* import { Rettiwt } from 'rettiwt-api';
|
|
70
114
|
*
|
|
71
115
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -82,8 +126,9 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
82
126
|
* ```
|
|
83
127
|
*
|
|
84
128
|
* @example
|
|
85
|
-
*
|
|
86
|
-
*
|
|
129
|
+
*
|
|
130
|
+
* #### Fetching the details of a single user using ID
|
|
131
|
+
* ```ts
|
|
87
132
|
* import { Rettiwt } from 'rettiwt-api';
|
|
88
133
|
*
|
|
89
134
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -92,7 +137,25 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
92
137
|
* // Fetching the details of the User with id '1234567890'
|
|
93
138
|
* rettiwt.user.details('1234567890')
|
|
94
139
|
* .then(res => {
|
|
95
|
-
* console.log(res);
|
|
140
|
+
* console.log(res); # 'res' is a single tweet
|
|
141
|
+
* })
|
|
142
|
+
* .catch(err => {
|
|
143
|
+
* console.log(err);
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
* * @example
|
|
147
|
+
*
|
|
148
|
+
* #### Fetching the details of multiple users
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
151
|
+
*
|
|
152
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
153
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
154
|
+
*
|
|
155
|
+
* // Fetching the details of the users with IDs '123', '456', '789'
|
|
156
|
+
* rettiwt.user.details(['123', '456', '789'])
|
|
157
|
+
* .then(res => {
|
|
158
|
+
* console.log(res); # 'res' is an array of users
|
|
96
159
|
* })
|
|
97
160
|
* .catch(err => {
|
|
98
161
|
* console.log(err);
|
|
@@ -113,15 +176,19 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
113
176
|
// If details of single user required
|
|
114
177
|
else {
|
|
115
178
|
// If username is given
|
|
116
|
-
if (isNaN(Number(id))) {
|
|
179
|
+
if (id && isNaN(Number(id))) {
|
|
117
180
|
resource = Resource_1.EResourceType.USER_DETAILS_BY_USERNAME;
|
|
118
181
|
}
|
|
119
|
-
// If id is given
|
|
182
|
+
// If id is given (or not, for self details)
|
|
120
183
|
else {
|
|
121
184
|
resource = Resource_1.EResourceType.USER_DETAILS_BY_ID;
|
|
122
185
|
}
|
|
186
|
+
// If no ID is given, and not authenticated, skip
|
|
187
|
+
if (!id && !this.config.userId) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
123
190
|
// Fetching raw details
|
|
124
|
-
const response = await this.request(resource, { id: id });
|
|
191
|
+
const response = await this.request(resource, { id: id ?? this.config.userId });
|
|
125
192
|
// Deserializing response
|
|
126
193
|
const data = Extractors_1.extractors[resource](response);
|
|
127
194
|
return data;
|
|
@@ -130,14 +197,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
130
197
|
/**
|
|
131
198
|
* Follow a user.
|
|
132
199
|
*
|
|
133
|
-
* @param id - The
|
|
200
|
+
* @param id - The ID the user to be followed.
|
|
134
201
|
*
|
|
135
202
|
* @returns Whether following was successful or not.
|
|
136
203
|
*
|
|
137
204
|
* @throws Code 108 if given user id is invalid.
|
|
138
205
|
*
|
|
139
206
|
* @example
|
|
140
|
-
*
|
|
207
|
+
*
|
|
208
|
+
* ```ts
|
|
141
209
|
* import { Rettiwt } from 'rettiwt-api';
|
|
142
210
|
*
|
|
143
211
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -169,7 +237,8 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
169
237
|
* @returns - The followed feed of the logged-in user.
|
|
170
238
|
*
|
|
171
239
|
* @example
|
|
172
|
-
*
|
|
240
|
+
*
|
|
241
|
+
* ```ts
|
|
173
242
|
* import { Rettiwt } from 'rettiwt-api';
|
|
174
243
|
*
|
|
175
244
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -200,14 +269,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
200
269
|
/**
|
|
201
270
|
* Get the list followers of a user.
|
|
202
271
|
*
|
|
203
|
-
* @param id - The
|
|
272
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
204
273
|
* @param count - The number of followers to fetch, must be \<= 100.
|
|
205
274
|
* @param cursor - The cursor to the batch of followers to fetch.
|
|
206
275
|
*
|
|
207
276
|
* @returns The list of users following the target user.
|
|
208
277
|
*
|
|
209
278
|
* @example
|
|
210
|
-
*
|
|
279
|
+
*
|
|
280
|
+
* ```ts
|
|
211
281
|
* import { Rettiwt } from 'rettiwt-api';
|
|
212
282
|
*
|
|
213
283
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -227,7 +297,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
227
297
|
const resource = Resource_1.EResourceType.USER_FOLLOWERS;
|
|
228
298
|
// Fetching raw list of followers
|
|
229
299
|
const response = await this.request(resource, {
|
|
230
|
-
id: id,
|
|
300
|
+
id: id ?? this.config.userId,
|
|
231
301
|
count: count,
|
|
232
302
|
cursor: cursor,
|
|
233
303
|
});
|
|
@@ -238,14 +308,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
238
308
|
/**
|
|
239
309
|
* Get the list of users who are followed by a user.
|
|
240
310
|
*
|
|
241
|
-
* @param id - The
|
|
311
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
242
312
|
* @param count - The number of following to fetch, must be \<= 100.
|
|
243
313
|
* @param cursor - The cursor to the batch of following to fetch.
|
|
244
314
|
*
|
|
245
315
|
* @returns The list of users followed by the target user.
|
|
246
316
|
*
|
|
247
317
|
* @example
|
|
248
|
-
*
|
|
318
|
+
*
|
|
319
|
+
* ```ts
|
|
249
320
|
* import { Rettiwt } from 'rettiwt-api';
|
|
250
321
|
*
|
|
251
322
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -265,7 +336,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
265
336
|
const resource = Resource_1.EResourceType.USER_FOLLOWING;
|
|
266
337
|
// Fetching raw list of following
|
|
267
338
|
const response = await this.request(resource, {
|
|
268
|
-
id: id,
|
|
339
|
+
id: id ?? this.config.userId,
|
|
269
340
|
count: count,
|
|
270
341
|
cursor: cursor,
|
|
271
342
|
});
|
|
@@ -276,14 +347,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
276
347
|
/**
|
|
277
348
|
* Get the highlighted tweets of a user.
|
|
278
349
|
*
|
|
279
|
-
* @param id - The
|
|
350
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
280
351
|
* @param count - The number of followers to fetch, must be \<= 100.
|
|
281
352
|
* @param cursor - The cursor to the batch of followers to fetch.
|
|
282
353
|
*
|
|
283
354
|
* @returns The list of highlighted tweets of the target user.
|
|
284
355
|
*
|
|
285
356
|
* @example
|
|
286
|
-
*
|
|
357
|
+
*
|
|
358
|
+
* ```ts
|
|
287
359
|
* import { Rettiwt } from 'rettiwt-api';
|
|
288
360
|
*
|
|
289
361
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -303,7 +375,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
303
375
|
const resource = Resource_1.EResourceType.USER_HIGHLIGHTS;
|
|
304
376
|
// Fetching raw list of highlights
|
|
305
377
|
const response = await this.request(resource, {
|
|
306
|
-
id: id,
|
|
378
|
+
id: id ?? this.config.userId,
|
|
307
379
|
count: count,
|
|
308
380
|
cursor: cursor,
|
|
309
381
|
});
|
|
@@ -320,7 +392,8 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
320
392
|
* @returns The list of tweets liked by the target user.
|
|
321
393
|
*
|
|
322
394
|
* @example
|
|
323
|
-
*
|
|
395
|
+
*
|
|
396
|
+
* ```ts
|
|
324
397
|
* import { Rettiwt } from 'rettiwt-api';
|
|
325
398
|
*
|
|
326
399
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -351,14 +424,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
351
424
|
/**
|
|
352
425
|
* Get the media timeline of a user.
|
|
353
426
|
*
|
|
354
|
-
* @param id - The
|
|
427
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
355
428
|
* @param count - The number of media to fetch, must be \<= 100.
|
|
356
429
|
* @param cursor - The cursor to the batch of media to fetch
|
|
357
430
|
*
|
|
358
431
|
* @returns The media timeline of the target user.
|
|
359
432
|
*
|
|
360
433
|
* @example
|
|
361
|
-
*
|
|
434
|
+
*
|
|
435
|
+
* ```ts
|
|
362
436
|
* import { Rettiwt } from 'rettiwt-api';
|
|
363
437
|
*
|
|
364
438
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -378,7 +452,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
378
452
|
const resource = Resource_1.EResourceType.USER_MEDIA;
|
|
379
453
|
// Fetching raw list of media
|
|
380
454
|
const response = await this.request(resource, {
|
|
381
|
-
id: id,
|
|
455
|
+
id: id ?? this.config.userId,
|
|
382
456
|
count: count,
|
|
383
457
|
cursor: cursor,
|
|
384
458
|
});
|
|
@@ -394,7 +468,8 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
394
468
|
* @returns An async generator that yields new notifications as they are received.
|
|
395
469
|
*
|
|
396
470
|
* @example
|
|
397
|
-
*
|
|
471
|
+
*
|
|
472
|
+
* ```ts
|
|
398
473
|
* import { Rettiwt } from 'rettiwt-api';
|
|
399
474
|
*
|
|
400
475
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -404,7 +479,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
404
479
|
* async function streamNotifications() {
|
|
405
480
|
* try {
|
|
406
481
|
* // Awaiting for the notifications returned by the AsyncGenerator returned by the method
|
|
407
|
-
* for await (const notification of rettiwt.user.notifications(
|
|
482
|
+
* for await (const notification of rettiwt.user.notifications(5000)) {
|
|
408
483
|
* console.log(notification.message);
|
|
409
484
|
* }
|
|
410
485
|
* }
|
|
@@ -457,7 +532,8 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
457
532
|
* @returns - The recommended feed of the logged-in user.
|
|
458
533
|
*
|
|
459
534
|
* @example
|
|
460
|
-
*
|
|
535
|
+
*
|
|
536
|
+
* ```ts
|
|
461
537
|
* import { Rettiwt } from 'rettiwt-api';
|
|
462
538
|
*
|
|
463
539
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -488,14 +564,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
488
564
|
/**
|
|
489
565
|
* Get the reply timeline of a user.
|
|
490
566
|
*
|
|
491
|
-
* @param id - The
|
|
567
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
492
568
|
* @param count - The number of replies to fetch, must be \<= 20.
|
|
493
569
|
* @param cursor - The cursor to the batch of replies to fetch.
|
|
494
570
|
*
|
|
495
571
|
* @returns The reply timeline of the target user.
|
|
496
572
|
*
|
|
497
573
|
* @example
|
|
498
|
-
*
|
|
574
|
+
*
|
|
575
|
+
* ```ts
|
|
499
576
|
* import { Rettiwt } from 'rettiwt-api';
|
|
500
577
|
*
|
|
501
578
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -511,13 +588,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
511
588
|
* });
|
|
512
589
|
* ```
|
|
513
590
|
*
|
|
514
|
-
* @remarks
|
|
591
|
+
* @remarks
|
|
592
|
+
*
|
|
593
|
+
* If the target user has a pinned tweet, the returned reply timeline has one item extra and this is always the pinned tweet.
|
|
515
594
|
*/
|
|
516
595
|
async replies(id, count, cursor) {
|
|
517
596
|
const resource = Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES;
|
|
518
597
|
// Fetching raw list of replies
|
|
519
598
|
const response = await this.request(resource, {
|
|
520
|
-
id: id,
|
|
599
|
+
id: id ?? this.config.userId,
|
|
521
600
|
count: count,
|
|
522
601
|
cursor: cursor,
|
|
523
602
|
});
|
|
@@ -528,14 +607,17 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
528
607
|
/**
|
|
529
608
|
* Get the list of subscriptions of a user.
|
|
530
609
|
*
|
|
531
|
-
* @
|
|
610
|
+
* @deprecated Currently not working.
|
|
611
|
+
*
|
|
612
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
532
613
|
* @param count - The number of subscriptions to fetch, must be \<= 100.
|
|
533
614
|
* @param cursor - The cursor to the batch of subscriptions to fetch.
|
|
534
615
|
*
|
|
535
616
|
* @returns The list of subscriptions by the target user.
|
|
536
617
|
*
|
|
537
618
|
* @example
|
|
538
|
-
*
|
|
619
|
+
*
|
|
620
|
+
* ```ts
|
|
539
621
|
* import { Rettiwt } from 'rettiwt-api';
|
|
540
622
|
*
|
|
541
623
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -555,7 +637,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
555
637
|
const resource = Resource_1.EResourceType.USER_SUBSCRIPTIONS;
|
|
556
638
|
// Fetching raw list of subscriptions
|
|
557
639
|
const response = await this.request(resource, {
|
|
558
|
-
id: id,
|
|
640
|
+
id: id ?? this.config.userId,
|
|
559
641
|
count: count,
|
|
560
642
|
cursor: cursor,
|
|
561
643
|
});
|
|
@@ -566,14 +648,15 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
566
648
|
/**
|
|
567
649
|
* Get the tweet timeline of a user.
|
|
568
650
|
*
|
|
569
|
-
* @param id - The
|
|
651
|
+
* @param id - The ID of the target user. If no ID is provided, the logged-in user's ID is used.
|
|
570
652
|
* @param count - The number of timeline items to fetch, must be \<= 20.
|
|
571
653
|
* @param cursor - The cursor to the batch of timeline items to fetch.
|
|
572
654
|
*
|
|
573
655
|
* @returns The timeline of the target user.
|
|
574
656
|
*
|
|
575
657
|
* @example
|
|
576
|
-
*
|
|
658
|
+
*
|
|
659
|
+
* ```ts
|
|
577
660
|
* import { Rettiwt } from 'rettiwt-api';
|
|
578
661
|
*
|
|
579
662
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -590,6 +673,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
590
673
|
* ```
|
|
591
674
|
*
|
|
592
675
|
* @remarks
|
|
676
|
+
*
|
|
593
677
|
* - If the target user has a pinned tweet, the returned timeline has one item extra and this is always the pinned tweet.
|
|
594
678
|
* - If timeline is fetched without authenticating, then the most popular tweets of the target user are returned instead.
|
|
595
679
|
*/
|
|
@@ -597,7 +681,7 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
597
681
|
const resource = Resource_1.EResourceType.USER_TIMELINE;
|
|
598
682
|
// Fetching raw list of tweets
|
|
599
683
|
const response = await this.request(resource, {
|
|
600
|
-
id: id,
|
|
684
|
+
id: id ?? this.config.userId,
|
|
601
685
|
count: count,
|
|
602
686
|
cursor: cursor,
|
|
603
687
|
});
|
|
@@ -608,14 +692,13 @@ class UserService extends FetcherService_1.FetcherService {
|
|
|
608
692
|
/**
|
|
609
693
|
* Unfollow a user.
|
|
610
694
|
*
|
|
611
|
-
* @param id - The
|
|
695
|
+
* @param id - The ID the user to be unfollowed.
|
|
612
696
|
*
|
|
613
697
|
* @returns Whether unfollowing was successful or not.
|
|
614
698
|
*
|
|
615
|
-
* @throws Code 34 if given user id is invalid.
|
|
616
|
-
*
|
|
617
699
|
* @example
|
|
618
|
-
*
|
|
700
|
+
*
|
|
701
|
+
* ```ts
|
|
619
702
|
* import { Rettiwt } from 'rettiwt-api';
|
|
620
703
|
*
|
|
621
704
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAC1D,mDAAqD;
|
|
1
|
+
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAC1D,mDAAqD;AAwBrD,qDAAkD;AAElD;;;;GAIG;AACH,MAAa,WAAY,SAAQ,+BAAc;IAC9C;;;;OAIG;IACH,YAAmB,MAAqB;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACI,KAAK,CAAC,UAAU,CAAC,EAAW,EAAE,KAAc,EAAE,MAAe;QACnE,MAAM,QAAQ,GAAG,wBAAa,CAAC,eAAe,CAAC;QAE/C,kCAAkC;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAA0B,QAAQ,EAAE;YACtE,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM;YAC5B,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;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,KAAK,CAAC,SAAS,CAAC,KAAc,EAAE,MAAe;QACrD,MAAM,QAAQ,GAAG,wBAAa,CAAC,cAAc,C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,CAAC,EAAU,EAAE,KAAc,EAAE,MAAe;QAChE,MAAM,QAAQ,GAAG,wBAAa,CAAC,aAAa,CAAC;QAE7C,8BAA8B;QAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAsB,QAAQ,EAAE;YAClE,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM;YAC5B,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;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACI,KAAK,CAAC,QAAQ,CAAC,EAAU;QAC/B,MAAM,QAAQ,GAAG,wBAAa,CAAC,aAAa,CAAC;QAE7C,uBAAuB;QACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAwB,wBAAa,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAEpG,6BAA6B;QAC7B,MAAM,IAAI,GAAG,uBAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;QAErD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AArxBD,kCAqxBC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ETweetRepliesSortType } from '../../enums/Tweet';
|
|
1
2
|
/**
|
|
2
3
|
* Options specifying the data that is to be fetched.
|
|
3
4
|
*
|
|
@@ -51,6 +52,13 @@ export interface IFetchArgs {
|
|
|
51
52
|
* - Required only for {@link EResourceType.TWEET_DETAILS_BULK} and {@link EResourceType.USER_DETAILS_BY_IDS_BULK}.
|
|
52
53
|
*/
|
|
53
54
|
ids?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* The sorting to use for tweet results.
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* - Only works for {@link EResourceType.TWEET_REPLIES}.
|
|
60
|
+
*/
|
|
61
|
+
sortBy?: ETweetRepliesSortType;
|
|
54
62
|
}
|
|
55
63
|
/**
|
|
56
64
|
* The filter to be used for searching tweets.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error thrown by Twitter API.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface ITwitterError extends Error {
|
|
7
|
+
/** The details of each error. */
|
|
8
|
+
details: ITwitterErrorDetails[];
|
|
9
|
+
/** The error message in the response. */
|
|
10
|
+
message: string;
|
|
11
|
+
/** The name of the error response. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** The response status code. */
|
|
14
|
+
status: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The error details.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface ITwitterErrorDetails {
|
|
22
|
+
/** The internal error code. */
|
|
23
|
+
code: number;
|
|
24
|
+
/** The message associated with the error. */
|
|
25
|
+
message: string;
|
|
26
|
+
/** The name of the error. */
|
|
27
|
+
name?: string;
|
|
28
|
+
/** The type of error. */
|
|
29
|
+
type?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TwitterError.js","sourceRoot":"","sources":["../../../src/types/errors/TwitterError.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error details for multiple errors.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IErrorData {
|
|
7
|
+
errors: IErrorDetails[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Error details of a single error.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface IErrorDetails {
|
|
15
|
+
message: string;
|
|
16
|
+
extensions?: IErrorExtensions;
|
|
17
|
+
code: number;
|
|
18
|
+
kind?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
source?: string;
|
|
21
|
+
tracing?: IErrorTracing;
|
|
22
|
+
}
|
|
23
|
+
export interface IErrorExtensions {
|
|
24
|
+
name: string;
|
|
25
|
+
source: string;
|
|
26
|
+
code: number;
|
|
27
|
+
kind: string;
|
|
28
|
+
tracing: IErrorTracing;
|
|
29
|
+
}
|
|
30
|
+
export interface IErrorTracing {
|
|
31
|
+
trace_id: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Error.js","sourceRoot":"","sources":["../../../../src/types/raw/base/Error.ts"],"names":[],"mappings":";AAAA,oBAAoB"}
|