rettiwt-api 5.0.0-alpha.4 → 5.0.1
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/.github/workflows/documentation.yml +3 -3
- package/README.md +160 -87
- package/dist/collections/Requests.d.ts +1 -1
- package/dist/collections/Requests.js +3 -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 +0 -15
- package/dist/commands/User.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/helper/TidUtils.d.ts +2 -0
- package/dist/helper/TidUtils.js +10 -1
- package/dist/helper/TidUtils.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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 +1 -1
- package/dist/models/data/List.js +1 -1
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Notification.d.ts +1 -1
- package/dist/models/data/Notification.js +1 -1
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +1 -1
- package/dist/models/data/Tweet.js +1 -1
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +1 -1
- package/dist/models/data/User.js +1 -1
- package/dist/models/data/User.js.map +1 -1
- package/dist/requests/Tweet.d.ts +2 -1
- package/dist/requests/Tweet.js +3 -4
- package/dist/requests/Tweet.js.map +1 -1
- package/dist/services/internal/AuthService.d.ts +1 -1
- package/dist/services/internal/AuthService.js +1 -1
- package/dist/services/internal/TidService.d.ts +0 -1
- package/dist/services/internal/TidService.js +10 -15
- package/dist/services/internal/TidService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +4 -3
- package/dist/services/public/FetcherService.js +6 -5
- 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 +80 -39
- package/dist/services/public/UserService.js +84 -43
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/args/FetchArgs.d.ts +8 -0
- package/package.json +1 -1
- package/src/collections/Requests.ts +5 -2
- package/src/collections/Tweet.ts +17 -0
- package/src/commands/Tweet.ts +0 -16
- package/src/commands/User.ts +0 -15
- package/src/enums/Tweet.ts +8 -0
- package/src/enums/raw/Tweet.ts +12 -1
- package/src/helper/TidUtils.ts +10 -1
- package/src/index.ts +1 -0
- 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 +1 -1
- package/src/models/data/Notification.ts +1 -1
- package/src/models/data/Tweet.ts +1 -1
- package/src/models/data/User.ts +1 -1
- package/src/requests/Tweet.ts +4 -5
- package/src/services/internal/AuthService.ts +1 -1
- package/src/services/internal/TidService.ts +12 -18
- package/src/services/public/FetcherService.ts +6 -5
- package/src/services/public/ListService.ts +6 -4
- package/src/services/public/TweetService.ts +101 -93
- package/src/services/public/UserService.ts +88 -47
- package/src/types/args/FetchArgs.ts +10 -0
|
@@ -4,6 +4,7 @@ exports.TweetService = void 0;
|
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const Extractors_1 = require("../../collections/Extractors");
|
|
6
6
|
const Resource_1 = require("../../enums/Resource");
|
|
7
|
+
const Tweet_1 = require("../../enums/Tweet");
|
|
7
8
|
const FetcherService_1 = require("./FetcherService");
|
|
8
9
|
/**
|
|
9
10
|
* Handles interacting with resources related to tweets.
|
|
@@ -20,16 +21,21 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
20
21
|
super(config);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* Get the details of
|
|
24
|
+
* Get the details of one or more tweets.
|
|
24
25
|
*
|
|
25
|
-
* @param id - The
|
|
26
|
+
* @param id - The ID/IDs of the target tweet/tweets.
|
|
26
27
|
*
|
|
27
28
|
* @returns
|
|
28
|
-
* The details of the tweet with the given
|
|
29
|
-
*
|
|
29
|
+
* The details of the tweet with the given ID.
|
|
30
|
+
*
|
|
31
|
+
* If more than one ID is provided, returns a list.
|
|
32
|
+
*
|
|
33
|
+
* If no tweet/tweets matches the given ID/IDs, returns `undefined`/`[]`.
|
|
30
34
|
*
|
|
31
35
|
* @example
|
|
32
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* #### Fetching the details of a single tweet
|
|
38
|
+
* ```ts
|
|
33
39
|
* import { Rettiwt } from 'rettiwt-api';
|
|
34
40
|
*
|
|
35
41
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -38,7 +44,26 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
38
44
|
* // Fetching the details of the tweet with the id '1234567890'
|
|
39
45
|
* rettiwt.tweet.details('1234567890')
|
|
40
46
|
* .then(res => {
|
|
41
|
-
* console.log(res);
|
|
47
|
+
* console.log(res); # 'res' is a single tweet
|
|
48
|
+
* })
|
|
49
|
+
* .catch(err => {
|
|
50
|
+
* console.log(err);
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
*
|
|
56
|
+
* #### Fetching the details of multiple tweets
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
59
|
+
*
|
|
60
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
61
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
62
|
+
*
|
|
63
|
+
* // Fetching the details of the tweets with IDs '123', '456', '789'
|
|
64
|
+
* rettiwt.tweet.details(['123', '456', '789'])
|
|
65
|
+
* .then(res => {
|
|
66
|
+
* console.log(res); # 'res' is an array of tweets
|
|
42
67
|
* })
|
|
43
68
|
* .catch(err => {
|
|
44
69
|
* console.log(err);
|
|
@@ -78,12 +103,13 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
78
103
|
/**
|
|
79
104
|
* Like a tweet.
|
|
80
105
|
*
|
|
81
|
-
* @param id - The
|
|
106
|
+
* @param id - The ID of the tweet to be liked.
|
|
82
107
|
*
|
|
83
108
|
* @returns Whether liking was successful or not.
|
|
84
109
|
*
|
|
85
110
|
* @example
|
|
86
|
-
*
|
|
111
|
+
*
|
|
112
|
+
* ```ts
|
|
87
113
|
* import { Rettiwt } from 'rettiwt-api';
|
|
88
114
|
*
|
|
89
115
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -112,14 +138,15 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
112
138
|
/**
|
|
113
139
|
* Get the list of users who liked a tweet. Only works for your own tweets.
|
|
114
140
|
*
|
|
115
|
-
* @param id - The
|
|
141
|
+
* @param id - The ID of the target tweet.
|
|
116
142
|
* @param count - The number of likers to fetch, must be \<= 100.
|
|
117
143
|
* @param cursor - The cursor to the batch of likers to fetch.
|
|
118
144
|
*
|
|
119
145
|
* @returns The list of users who liked the given tweet.
|
|
120
146
|
*
|
|
121
147
|
* @example
|
|
122
|
-
*
|
|
148
|
+
*
|
|
149
|
+
* ```ts
|
|
123
150
|
* import { Rettiwt } from 'rettiwt-api';
|
|
124
151
|
*
|
|
125
152
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -147,58 +174,17 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
147
174
|
const data = Extractors_1.extractors[resource](response);
|
|
148
175
|
return data;
|
|
149
176
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Get the list of tweets from a tweet list.
|
|
152
|
-
*
|
|
153
|
-
* @param id - The id of target list.
|
|
154
|
-
* @param count - The number of tweets to fetch, must be \<= 100.
|
|
155
|
-
* @param cursor - The cursor to the batch of tweets to fetch.
|
|
156
|
-
*
|
|
157
|
-
* @returns The list tweets in the given list.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```
|
|
161
|
-
* import { Rettiwt } from 'rettiwt-api';
|
|
162
|
-
*
|
|
163
|
-
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
164
|
-
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
165
|
-
*
|
|
166
|
-
* // Fetching the most recent 100 tweets of the Twitter list with id '1234567890'
|
|
167
|
-
* rettiwt.tweet.list('1234567890')
|
|
168
|
-
* .then(res => {
|
|
169
|
-
* console.log(res);
|
|
170
|
-
* })
|
|
171
|
-
* .catch(err => {
|
|
172
|
-
* console.log(err);
|
|
173
|
-
* });
|
|
174
|
-
* ```
|
|
175
|
-
*
|
|
176
|
-
* @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
|
|
177
|
-
*/
|
|
178
|
-
async list(id, count, cursor) {
|
|
179
|
-
const resource = Resource_1.EResourceType.LIST_TWEETS;
|
|
180
|
-
// Fetching raw list tweets
|
|
181
|
-
const response = await this.request(resource, {
|
|
182
|
-
id: id,
|
|
183
|
-
count: count,
|
|
184
|
-
cursor: cursor,
|
|
185
|
-
});
|
|
186
|
-
// Deserializing response
|
|
187
|
-
const data = Extractors_1.extractors[resource](response);
|
|
188
|
-
// Sorting the tweets by date, from recent to oldest
|
|
189
|
-
data.list.sort((a, b) => new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf());
|
|
190
|
-
return data;
|
|
191
|
-
}
|
|
192
177
|
/**
|
|
193
178
|
* Post a tweet.
|
|
194
179
|
*
|
|
195
180
|
* @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
|
|
196
181
|
*
|
|
197
|
-
* @returns The
|
|
182
|
+
* @returns The ID of the posted tweet.
|
|
198
183
|
*
|
|
199
184
|
* @example
|
|
200
|
-
*
|
|
201
|
-
*
|
|
185
|
+
*
|
|
186
|
+
* #### Posting a simple text
|
|
187
|
+
* ```ts
|
|
202
188
|
* import { Rettiwt } from 'rettiwt-api';
|
|
203
189
|
*
|
|
204
190
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -215,14 +201,15 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
215
201
|
* ```
|
|
216
202
|
*
|
|
217
203
|
* @example
|
|
218
|
-
*
|
|
219
|
-
*
|
|
204
|
+
*
|
|
205
|
+
* #### Posting a tweet with an image that has been already uploaded
|
|
206
|
+
* ```ts
|
|
220
207
|
* import { Rettiwt } from 'rettiwt-api';
|
|
221
208
|
*
|
|
222
209
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
223
210
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
224
211
|
*
|
|
225
|
-
* // Posting a tweet, containing an image
|
|
212
|
+
* // Posting a tweet, containing an image with ID '1234567890', to twitter
|
|
226
213
|
* rettiwt.tweet.post({ text: 'What a nice view!', media: [{ id: '1234567890' }] })
|
|
227
214
|
* .then(res => {
|
|
228
215
|
* console.log(res);
|
|
@@ -233,8 +220,9 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
233
220
|
* ```
|
|
234
221
|
*
|
|
235
222
|
* @example
|
|
236
|
-
*
|
|
237
|
-
*
|
|
223
|
+
*
|
|
224
|
+
* #### Posting a reply to a tweet
|
|
225
|
+
* ```ts
|
|
238
226
|
* import { Rettiwt } from 'rettiwt-api';
|
|
239
227
|
*
|
|
240
228
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -250,9 +238,10 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
250
238
|
* });
|
|
251
239
|
* ```
|
|
252
240
|
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
241
|
+
* @example
|
|
242
|
+
*
|
|
243
|
+
* #### Posting a tweet that quotes another tweet
|
|
244
|
+
* ```ts
|
|
256
245
|
* import { Rettiwt } from 'rettiwt-api';
|
|
257
246
|
*
|
|
258
247
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -279,13 +268,15 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
279
268
|
/**
|
|
280
269
|
* Get the list of replies to a tweet.
|
|
281
270
|
*
|
|
282
|
-
* @param id - The
|
|
271
|
+
* @param id - The ID of the target tweet.
|
|
283
272
|
* @param cursor - The cursor to the batch of replies to fetch.
|
|
273
|
+
* @param sortBy - The sorting order of the replies to fetch. Default is {@link ETweetRepliesSortType.RECENT}.
|
|
284
274
|
*
|
|
285
275
|
* @returns The list of replies to the given tweet.
|
|
286
276
|
*
|
|
287
277
|
* @example
|
|
288
|
-
*
|
|
278
|
+
*
|
|
279
|
+
* ```ts
|
|
289
280
|
* import { Rettiwt } from 'rettiwt-api';
|
|
290
281
|
*
|
|
291
282
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -300,13 +291,18 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
300
291
|
* console.log(err);
|
|
301
292
|
* });
|
|
302
293
|
* ```
|
|
294
|
+
*
|
|
295
|
+
* @remarks
|
|
296
|
+
*
|
|
297
|
+
* If the given tweet is the start of/part of a thread, the first batch always contains all the tweets in the thread.
|
|
303
298
|
*/
|
|
304
|
-
async replies(id, cursor) {
|
|
299
|
+
async replies(id, cursor, sortBy = Tweet_1.ETweetRepliesSortType.LATEST) {
|
|
305
300
|
const resource = Resource_1.EResourceType.TWEET_REPLIES;
|
|
306
301
|
// Fetching raw list of replies
|
|
307
302
|
const response = await this.request(resource, {
|
|
308
303
|
id: id,
|
|
309
304
|
cursor: cursor,
|
|
305
|
+
sortBy: sortBy,
|
|
310
306
|
});
|
|
311
307
|
// Deserializing response
|
|
312
308
|
const data = Extractors_1.extractors[resource](response);
|
|
@@ -315,12 +311,13 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
315
311
|
/**
|
|
316
312
|
* Retweet a tweet.
|
|
317
313
|
*
|
|
318
|
-
* @param id - The
|
|
314
|
+
* @param id - The ID of the target tweet.
|
|
319
315
|
*
|
|
320
316
|
* @returns Whether retweeting was successful or not.
|
|
321
317
|
*
|
|
322
318
|
* @example
|
|
323
|
-
*
|
|
319
|
+
*
|
|
320
|
+
* ```ts
|
|
324
321
|
* import { Rettiwt } from 'rettiwt-api';
|
|
325
322
|
*
|
|
326
323
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -347,14 +344,15 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
347
344
|
/**
|
|
348
345
|
* Get the list of users who retweeted a tweet.
|
|
349
346
|
*
|
|
350
|
-
* @param id - The
|
|
347
|
+
* @param id - The ID of the target tweet.
|
|
351
348
|
* @param count - The number of retweeters to fetch, must be \<= 100.
|
|
352
349
|
* @param cursor - The cursor to the batch of retweeters to fetch.
|
|
353
350
|
*
|
|
354
351
|
* @returns The list of users who retweeted the given tweet.
|
|
355
352
|
*
|
|
356
353
|
* @example
|
|
357
|
-
*
|
|
354
|
+
*
|
|
355
|
+
* ```ts
|
|
358
356
|
* import { Rettiwt } from 'rettiwt-api';
|
|
359
357
|
*
|
|
360
358
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -387,11 +385,12 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
387
385
|
*
|
|
388
386
|
* @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
|
|
389
387
|
*
|
|
390
|
-
* @returns The
|
|
388
|
+
* @returns The ID of the schedule.
|
|
391
389
|
*
|
|
392
390
|
* @example
|
|
393
|
-
*
|
|
394
|
-
*
|
|
391
|
+
*
|
|
392
|
+
* #### Scheduling a simple text
|
|
393
|
+
* ```ts
|
|
395
394
|
* import { Rettiwt } from 'rettiwt-api';
|
|
396
395
|
*
|
|
397
396
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -408,6 +407,7 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
408
407
|
* ```
|
|
409
408
|
*
|
|
410
409
|
* @remarks
|
|
410
|
+
*
|
|
411
411
|
* Scheduling a tweet is similar to {@link post}ing, except that an extra parameter called `scheduleFor` is used.
|
|
412
412
|
*/
|
|
413
413
|
async schedule(options) {
|
|
@@ -429,7 +429,8 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
429
429
|
* @returns The list of tweets that match the given filter.
|
|
430
430
|
*
|
|
431
431
|
* @example
|
|
432
|
-
*
|
|
432
|
+
*
|
|
433
|
+
* ```ts
|
|
433
434
|
* import { Rettiwt } from 'rettiwt-api';
|
|
434
435
|
*
|
|
435
436
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -445,7 +446,9 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
445
446
|
* });
|
|
446
447
|
* ```
|
|
447
448
|
*
|
|
448
|
-
* @remarks
|
|
449
|
+
* @remarks
|
|
450
|
+
*
|
|
451
|
+
* For details about available filters, refer to {@link TweetFilter}
|
|
449
452
|
*/
|
|
450
453
|
async search(filter, count, cursor) {
|
|
451
454
|
const resource = Resource_1.EResourceType.TWEET_SEARCH;
|
|
@@ -470,7 +473,8 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
470
473
|
* @returns An async generator that yields matching tweets as they are found.
|
|
471
474
|
*
|
|
472
475
|
* @example
|
|
473
|
-
*
|
|
476
|
+
*
|
|
477
|
+
* ```ts
|
|
474
478
|
* import { Rettiwt } from 'rettiwt-api';
|
|
475
479
|
*
|
|
476
480
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -480,7 +484,7 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
480
484
|
* async function streamTweets() {
|
|
481
485
|
* try {
|
|
482
486
|
* // Awaiting for the tweets returned by the AsyncGenerator returned by the method
|
|
483
|
-
* for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] },
|
|
487
|
+
* for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] }, 5000)) {
|
|
484
488
|
* console.log(tweet.fullText);
|
|
485
489
|
* }
|
|
486
490
|
* }
|
|
@@ -525,12 +529,13 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
525
529
|
/**
|
|
526
530
|
* Unlike a tweet.
|
|
527
531
|
*
|
|
528
|
-
* @param id - The
|
|
532
|
+
* @param id - The ID of the target tweet.
|
|
529
533
|
*
|
|
530
534
|
* @returns Whether unliking was successful or not.
|
|
531
535
|
*
|
|
532
536
|
* @example
|
|
533
|
-
*
|
|
537
|
+
*
|
|
538
|
+
* ```ts
|
|
534
539
|
* import { Rettiwt } from 'rettiwt-api';
|
|
535
540
|
*
|
|
536
541
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -557,12 +562,13 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
557
562
|
/**
|
|
558
563
|
* Unpost a tweet.
|
|
559
564
|
*
|
|
560
|
-
* @param id - The
|
|
565
|
+
* @param id - The ID of the target tweet.
|
|
561
566
|
*
|
|
562
567
|
* @returns Whether unposting was successful or not.
|
|
563
568
|
*
|
|
564
569
|
* @example
|
|
565
|
-
*
|
|
570
|
+
*
|
|
571
|
+
* ```ts
|
|
566
572
|
* import { Rettiwt } from 'rettiwt-api';
|
|
567
573
|
*
|
|
568
574
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -589,12 +595,13 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
589
595
|
/**
|
|
590
596
|
* Unretweet a tweet.
|
|
591
597
|
*
|
|
592
|
-
* @param id - The
|
|
598
|
+
* @param id - The ID of the target tweet.
|
|
593
599
|
*
|
|
594
600
|
* @returns Whether unretweeting was successful or not.
|
|
595
601
|
*
|
|
596
602
|
* @example
|
|
597
|
-
*
|
|
603
|
+
*
|
|
604
|
+
* ```ts
|
|
598
605
|
* import { Rettiwt } from 'rettiwt-api';
|
|
599
606
|
*
|
|
600
607
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -621,12 +628,13 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
621
628
|
/**
|
|
622
629
|
* Unschedule a tweet.
|
|
623
630
|
*
|
|
624
|
-
* @param id - The
|
|
631
|
+
* @param id - The ID of the scheduled tweet.
|
|
625
632
|
*
|
|
626
633
|
* @returns Whether unscheduling was successful or not.
|
|
627
634
|
*
|
|
628
635
|
* @example
|
|
629
|
-
*
|
|
636
|
+
*
|
|
637
|
+
* ```ts
|
|
630
638
|
* import { Rettiwt } from 'rettiwt-api';
|
|
631
639
|
*
|
|
632
640
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -655,10 +663,11 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
655
663
|
*
|
|
656
664
|
* @param media - The path or ArrayBuffer to the media file to upload.
|
|
657
665
|
*
|
|
658
|
-
* @returns The
|
|
666
|
+
* @returns The ID of the uploaded media.
|
|
659
667
|
*
|
|
660
668
|
* @example
|
|
661
|
-
*
|
|
669
|
+
*
|
|
670
|
+
* ```ts
|
|
662
671
|
* import { Rettiwt } from 'rettiwt-api';
|
|
663
672
|
*
|
|
664
673
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -675,6 +684,7 @@ class TweetService extends FetcherService_1.FetcherService {
|
|
|
675
684
|
* ```
|
|
676
685
|
*
|
|
677
686
|
* @remarks
|
|
687
|
+
*
|
|
678
688
|
* - The uploaded media exists for 24 hrs within which it can be included in a tweet to be posted.
|
|
679
689
|
* If not posted in a tweet within this period, the uploaded media is removed.
|
|
680
690
|
* - Instead of a path to the media, an ArrayBuffer containing the media can also be uploaded.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TweetService.js","sourceRoot":"","sources":["../../../src/services/public/TweetService.ts"],"names":[],"mappings":";;;AAAA,2BAA8B;AAE9B,6DAA0D;AAC1D,mDAAqD;
|
|
1
|
+
{"version":3,"file":"TweetService.js","sourceRoot":"","sources":["../../../src/services/public/TweetService.ts"],"names":[],"mappings":";;;AAAA,2BAA8B;AAE9B,6DAA0D;AAC1D,mDAAqD;AACrD,6CAA0D;AAyB1D,qDAAkD;AAElD;;;;GAIG;AACH,MAAa,YAAa,SAAQ,+BAAc;IAC/C;;;;OAIG;IACH,YAAmB,MAAqB;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACI,KAAK,CAAC,OAAO,CAA8B,EAAK;QACtD,IAAI,QAAuB,CAAC;QAE5B,gEAAgE;QAChE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,SAAS,IAAI,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC9D,QAAQ,GAAG,wBAAa,CAAC,iBAAiB,CAAC;YAE3C,6BAA6B;YAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAwB,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;YAEjF,yBAAyB;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