rettiwt-api 5.0.0-alpha.4 → 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/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/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/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
|
@@ -2,6 +2,7 @@ import { statSync } from 'fs';
|
|
|
2
2
|
|
|
3
3
|
import { extractors } from '../../collections/Extractors';
|
|
4
4
|
import { EResourceType } from '../../enums/Resource';
|
|
5
|
+
import { ETweetRepliesSortType } from '../../enums/Tweet';
|
|
5
6
|
import { CursoredData } from '../../models/data/CursoredData';
|
|
6
7
|
import { Tweet } from '../../models/data/Tweet';
|
|
7
8
|
import { User } from '../../models/data/User';
|
|
@@ -9,7 +10,6 @@ import { User } from '../../models/data/User';
|
|
|
9
10
|
import { RettiwtConfig } from '../../models/RettiwtConfig';
|
|
10
11
|
import { ITweetFilter } from '../../types/args/FetchArgs';
|
|
11
12
|
import { INewTweet } from '../../types/args/PostArgs';
|
|
12
|
-
import { IListTweetsResponse } from '../../types/raw/list/Tweets';
|
|
13
13
|
import { IMediaInitializeUploadResponse } from '../../types/raw/media/InitalizeUpload';
|
|
14
14
|
|
|
15
15
|
import { ITweetDetailsResponse } from '../../types/raw/tweet/Details';
|
|
@@ -45,16 +45,21 @@ export class TweetService extends FetcherService {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Get the details of
|
|
48
|
+
* Get the details of one or more tweets.
|
|
49
49
|
*
|
|
50
|
-
* @param id - The
|
|
50
|
+
* @param id - The ID/IDs of the target tweet/tweets.
|
|
51
51
|
*
|
|
52
52
|
* @returns
|
|
53
|
-
* The details of the tweet with the given
|
|
54
|
-
*
|
|
53
|
+
* The details of the tweet with the given ID.
|
|
54
|
+
*
|
|
55
|
+
* If more than one ID is provided, returns a list.
|
|
56
|
+
*
|
|
57
|
+
* If no tweet/tweets matches the given ID/IDs, returns `undefined`/`[]`.
|
|
55
58
|
*
|
|
56
59
|
* @example
|
|
57
|
-
*
|
|
60
|
+
*
|
|
61
|
+
* #### Fetching the details of a single tweet
|
|
62
|
+
* ```ts
|
|
58
63
|
* import { Rettiwt } from 'rettiwt-api';
|
|
59
64
|
*
|
|
60
65
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -63,7 +68,26 @@ export class TweetService extends FetcherService {
|
|
|
63
68
|
* // Fetching the details of the tweet with the id '1234567890'
|
|
64
69
|
* rettiwt.tweet.details('1234567890')
|
|
65
70
|
* .then(res => {
|
|
66
|
-
* console.log(res);
|
|
71
|
+
* console.log(res); # 'res' is a single tweet
|
|
72
|
+
* })
|
|
73
|
+
* .catch(err => {
|
|
74
|
+
* console.log(err);
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
*
|
|
80
|
+
* #### Fetching the details of multiple tweets
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
83
|
+
*
|
|
84
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
85
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
86
|
+
*
|
|
87
|
+
* // Fetching the details of the tweets with IDs '123', '456', '789'
|
|
88
|
+
* rettiwt.tweet.details(['123', '456', '789'])
|
|
89
|
+
* .then(res => {
|
|
90
|
+
* console.log(res); # 'res' is an array of tweets
|
|
67
91
|
* })
|
|
68
92
|
* .catch(err => {
|
|
69
93
|
* console.log(err);
|
|
@@ -114,12 +138,13 @@ export class TweetService extends FetcherService {
|
|
|
114
138
|
/**
|
|
115
139
|
* Like a tweet.
|
|
116
140
|
*
|
|
117
|
-
* @param id - The
|
|
141
|
+
* @param id - The ID of the tweet to be liked.
|
|
118
142
|
*
|
|
119
143
|
* @returns Whether liking was successful or not.
|
|
120
144
|
*
|
|
121
145
|
* @example
|
|
122
|
-
*
|
|
146
|
+
*
|
|
147
|
+
* ```ts
|
|
123
148
|
* import { Rettiwt } from 'rettiwt-api';
|
|
124
149
|
*
|
|
125
150
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -152,14 +177,15 @@ export class TweetService extends FetcherService {
|
|
|
152
177
|
/**
|
|
153
178
|
* Get the list of users who liked a tweet. Only works for your own tweets.
|
|
154
179
|
*
|
|
155
|
-
* @param id - The
|
|
180
|
+
* @param id - The ID of the target tweet.
|
|
156
181
|
* @param count - The number of likers to fetch, must be \<= 100.
|
|
157
182
|
* @param cursor - The cursor to the batch of likers to fetch.
|
|
158
183
|
*
|
|
159
184
|
* @returns The list of users who liked the given tweet.
|
|
160
185
|
*
|
|
161
186
|
* @example
|
|
162
|
-
*
|
|
187
|
+
*
|
|
188
|
+
* ```ts
|
|
163
189
|
* import { Rettiwt } from 'rettiwt-api';
|
|
164
190
|
*
|
|
165
191
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -191,63 +217,17 @@ export class TweetService extends FetcherService {
|
|
|
191
217
|
return data;
|
|
192
218
|
}
|
|
193
219
|
|
|
194
|
-
/**
|
|
195
|
-
* Get the list of tweets from a tweet list.
|
|
196
|
-
*
|
|
197
|
-
* @param id - The id of target list.
|
|
198
|
-
* @param count - The number of tweets to fetch, must be \<= 100.
|
|
199
|
-
* @param cursor - The cursor to the batch of tweets to fetch.
|
|
200
|
-
*
|
|
201
|
-
* @returns The list tweets in the given list.
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ```
|
|
205
|
-
* import { Rettiwt } from 'rettiwt-api';
|
|
206
|
-
*
|
|
207
|
-
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
208
|
-
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
209
|
-
*
|
|
210
|
-
* // Fetching the most recent 100 tweets of the Twitter list with id '1234567890'
|
|
211
|
-
* rettiwt.tweet.list('1234567890')
|
|
212
|
-
* .then(res => {
|
|
213
|
-
* console.log(res);
|
|
214
|
-
* })
|
|
215
|
-
* .catch(err => {
|
|
216
|
-
* console.log(err);
|
|
217
|
-
* });
|
|
218
|
-
* ```
|
|
219
|
-
*
|
|
220
|
-
* @remarks Due a bug in Twitter API, the count is ignored when no cursor is provided and defaults to 100.
|
|
221
|
-
*/
|
|
222
|
-
public async list(id: string, count?: number, cursor?: string): Promise<CursoredData<Tweet>> {
|
|
223
|
-
const resource = EResourceType.LIST_TWEETS;
|
|
224
|
-
|
|
225
|
-
// Fetching raw list tweets
|
|
226
|
-
const response = await this.request<IListTweetsResponse>(resource, {
|
|
227
|
-
id: id,
|
|
228
|
-
count: count,
|
|
229
|
-
cursor: cursor,
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
// Deserializing response
|
|
233
|
-
const data = extractors[resource](response);
|
|
234
|
-
|
|
235
|
-
// Sorting the tweets by date, from recent to oldest
|
|
236
|
-
data.list.sort((a, b) => new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf());
|
|
237
|
-
|
|
238
|
-
return data;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
220
|
/**
|
|
242
221
|
* Post a tweet.
|
|
243
222
|
*
|
|
244
223
|
* @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
|
|
245
224
|
*
|
|
246
|
-
* @returns The
|
|
225
|
+
* @returns The ID of the posted tweet.
|
|
247
226
|
*
|
|
248
227
|
* @example
|
|
249
|
-
*
|
|
250
|
-
*
|
|
228
|
+
*
|
|
229
|
+
* #### Posting a simple text
|
|
230
|
+
* ```ts
|
|
251
231
|
* import { Rettiwt } from 'rettiwt-api';
|
|
252
232
|
*
|
|
253
233
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -264,14 +244,15 @@ export class TweetService extends FetcherService {
|
|
|
264
244
|
* ```
|
|
265
245
|
*
|
|
266
246
|
* @example
|
|
267
|
-
*
|
|
268
|
-
*
|
|
247
|
+
*
|
|
248
|
+
* #### Posting a tweet with an image that has been already uploaded
|
|
249
|
+
* ```ts
|
|
269
250
|
* import { Rettiwt } from 'rettiwt-api';
|
|
270
251
|
*
|
|
271
252
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
272
253
|
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
273
254
|
*
|
|
274
|
-
* // Posting a tweet, containing an image
|
|
255
|
+
* // Posting a tweet, containing an image with ID '1234567890', to twitter
|
|
275
256
|
* rettiwt.tweet.post({ text: 'What a nice view!', media: [{ id: '1234567890' }] })
|
|
276
257
|
* .then(res => {
|
|
277
258
|
* console.log(res);
|
|
@@ -282,8 +263,9 @@ export class TweetService extends FetcherService {
|
|
|
282
263
|
* ```
|
|
283
264
|
*
|
|
284
265
|
* @example
|
|
285
|
-
*
|
|
286
|
-
*
|
|
266
|
+
*
|
|
267
|
+
* #### Posting a reply to a tweet
|
|
268
|
+
* ```ts
|
|
287
269
|
* import { Rettiwt } from 'rettiwt-api';
|
|
288
270
|
*
|
|
289
271
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -299,9 +281,10 @@ export class TweetService extends FetcherService {
|
|
|
299
281
|
* });
|
|
300
282
|
* ```
|
|
301
283
|
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
284
|
+
* @example
|
|
285
|
+
*
|
|
286
|
+
* #### Posting a tweet that quotes another tweet
|
|
287
|
+
* ```ts
|
|
305
288
|
* import { Rettiwt } from 'rettiwt-api';
|
|
306
289
|
*
|
|
307
290
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -332,13 +315,15 @@ export class TweetService extends FetcherService {
|
|
|
332
315
|
/**
|
|
333
316
|
* Get the list of replies to a tweet.
|
|
334
317
|
*
|
|
335
|
-
* @param id - The
|
|
318
|
+
* @param id - The ID of the target tweet.
|
|
336
319
|
* @param cursor - The cursor to the batch of replies to fetch.
|
|
320
|
+
* @param sortBy - The sorting order of the replies to fetch. Default is {@link ETweetRepliesSortType.RECENT}.
|
|
337
321
|
*
|
|
338
322
|
* @returns The list of replies to the given tweet.
|
|
339
323
|
*
|
|
340
324
|
* @example
|
|
341
|
-
*
|
|
325
|
+
*
|
|
326
|
+
* ```ts
|
|
342
327
|
* import { Rettiwt } from 'rettiwt-api';
|
|
343
328
|
*
|
|
344
329
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -353,14 +338,23 @@ export class TweetService extends FetcherService {
|
|
|
353
338
|
* console.log(err);
|
|
354
339
|
* });
|
|
355
340
|
* ```
|
|
341
|
+
*
|
|
342
|
+
* @remarks
|
|
343
|
+
*
|
|
344
|
+
* If the given tweet is the start of/part of a thread, the first batch always contains all the tweets in the thread.
|
|
356
345
|
*/
|
|
357
|
-
public async replies(
|
|
346
|
+
public async replies(
|
|
347
|
+
id: string,
|
|
348
|
+
cursor?: string,
|
|
349
|
+
sortBy: ETweetRepliesSortType = ETweetRepliesSortType.LATEST,
|
|
350
|
+
): Promise<CursoredData<Tweet>> {
|
|
358
351
|
const resource = EResourceType.TWEET_REPLIES;
|
|
359
352
|
|
|
360
353
|
// Fetching raw list of replies
|
|
361
354
|
const response = await this.request<ITweetDetailsResponse>(resource, {
|
|
362
355
|
id: id,
|
|
363
356
|
cursor: cursor,
|
|
357
|
+
sortBy: sortBy,
|
|
364
358
|
});
|
|
365
359
|
|
|
366
360
|
// Deserializing response
|
|
@@ -372,12 +366,13 @@ export class TweetService extends FetcherService {
|
|
|
372
366
|
/**
|
|
373
367
|
* Retweet a tweet.
|
|
374
368
|
*
|
|
375
|
-
* @param id - The
|
|
369
|
+
* @param id - The ID of the target tweet.
|
|
376
370
|
*
|
|
377
371
|
* @returns Whether retweeting was successful or not.
|
|
378
372
|
*
|
|
379
373
|
* @example
|
|
380
|
-
*
|
|
374
|
+
*
|
|
375
|
+
* ```ts
|
|
381
376
|
* import { Rettiwt } from 'rettiwt-api';
|
|
382
377
|
*
|
|
383
378
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -408,14 +403,15 @@ export class TweetService extends FetcherService {
|
|
|
408
403
|
/**
|
|
409
404
|
* Get the list of users who retweeted a tweet.
|
|
410
405
|
*
|
|
411
|
-
* @param id - The
|
|
406
|
+
* @param id - The ID of the target tweet.
|
|
412
407
|
* @param count - The number of retweeters to fetch, must be \<= 100.
|
|
413
408
|
* @param cursor - The cursor to the batch of retweeters to fetch.
|
|
414
409
|
*
|
|
415
410
|
* @returns The list of users who retweeted the given tweet.
|
|
416
411
|
*
|
|
417
412
|
* @example
|
|
418
|
-
*
|
|
413
|
+
*
|
|
414
|
+
* ```ts
|
|
419
415
|
* import { Rettiwt } from 'rettiwt-api';
|
|
420
416
|
*
|
|
421
417
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -452,11 +448,12 @@ export class TweetService extends FetcherService {
|
|
|
452
448
|
*
|
|
453
449
|
* @param options - The options describing the tweet to be posted. Check {@link TweetArgs} for available options.
|
|
454
450
|
*
|
|
455
|
-
* @returns The
|
|
451
|
+
* @returns The ID of the schedule.
|
|
456
452
|
*
|
|
457
453
|
* @example
|
|
458
|
-
*
|
|
459
|
-
*
|
|
454
|
+
*
|
|
455
|
+
* #### Scheduling a simple text
|
|
456
|
+
* ```ts
|
|
460
457
|
* import { Rettiwt } from 'rettiwt-api';
|
|
461
458
|
*
|
|
462
459
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -473,6 +470,7 @@ export class TweetService extends FetcherService {
|
|
|
473
470
|
* ```
|
|
474
471
|
*
|
|
475
472
|
* @remarks
|
|
473
|
+
*
|
|
476
474
|
* Scheduling a tweet is similar to {@link post}ing, except that an extra parameter called `scheduleFor` is used.
|
|
477
475
|
*/
|
|
478
476
|
public async schedule(options: INewTweet): Promise<string | undefined> {
|
|
@@ -498,7 +496,8 @@ export class TweetService extends FetcherService {
|
|
|
498
496
|
* @returns The list of tweets that match the given filter.
|
|
499
497
|
*
|
|
500
498
|
* @example
|
|
501
|
-
*
|
|
499
|
+
*
|
|
500
|
+
* ```ts
|
|
502
501
|
* import { Rettiwt } from 'rettiwt-api';
|
|
503
502
|
*
|
|
504
503
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -514,7 +513,9 @@ export class TweetService extends FetcherService {
|
|
|
514
513
|
* });
|
|
515
514
|
* ```
|
|
516
515
|
*
|
|
517
|
-
* @remarks
|
|
516
|
+
* @remarks
|
|
517
|
+
*
|
|
518
|
+
* For details about available filters, refer to {@link TweetFilter}
|
|
518
519
|
*/
|
|
519
520
|
public async search(filter: ITweetFilter, count?: number, cursor?: string): Promise<CursoredData<Tweet>> {
|
|
520
521
|
const resource = EResourceType.TWEET_SEARCH;
|
|
@@ -544,7 +545,8 @@ export class TweetService extends FetcherService {
|
|
|
544
545
|
* @returns An async generator that yields matching tweets as they are found.
|
|
545
546
|
*
|
|
546
547
|
* @example
|
|
547
|
-
*
|
|
548
|
+
*
|
|
549
|
+
* ```ts
|
|
548
550
|
* import { Rettiwt } from 'rettiwt-api';
|
|
549
551
|
*
|
|
550
552
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -554,7 +556,7 @@ export class TweetService extends FetcherService {
|
|
|
554
556
|
* async function streamTweets() {
|
|
555
557
|
* try {
|
|
556
558
|
* // Awaiting for the tweets returned by the AsyncGenerator returned by the method
|
|
557
|
-
* for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] },
|
|
559
|
+
* for await (const tweet of rettiwt.tweet.stream({ fromUsers: ['user1'] }, 5000)) {
|
|
558
560
|
* console.log(tweet.fullText);
|
|
559
561
|
* }
|
|
560
562
|
* }
|
|
@@ -606,12 +608,13 @@ export class TweetService extends FetcherService {
|
|
|
606
608
|
/**
|
|
607
609
|
* Unlike a tweet.
|
|
608
610
|
*
|
|
609
|
-
* @param id - The
|
|
611
|
+
* @param id - The ID of the target tweet.
|
|
610
612
|
*
|
|
611
613
|
* @returns Whether unliking was successful or not.
|
|
612
614
|
*
|
|
613
615
|
* @example
|
|
614
|
-
*
|
|
616
|
+
*
|
|
617
|
+
* ```ts
|
|
615
618
|
* import { Rettiwt } from 'rettiwt-api';
|
|
616
619
|
*
|
|
617
620
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -642,12 +645,13 @@ export class TweetService extends FetcherService {
|
|
|
642
645
|
/**
|
|
643
646
|
* Unpost a tweet.
|
|
644
647
|
*
|
|
645
|
-
* @param id - The
|
|
648
|
+
* @param id - The ID of the target tweet.
|
|
646
649
|
*
|
|
647
650
|
* @returns Whether unposting was successful or not.
|
|
648
651
|
*
|
|
649
652
|
* @example
|
|
650
|
-
*
|
|
653
|
+
*
|
|
654
|
+
* ```ts
|
|
651
655
|
* import { Rettiwt } from 'rettiwt-api';
|
|
652
656
|
*
|
|
653
657
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -678,12 +682,13 @@ export class TweetService extends FetcherService {
|
|
|
678
682
|
/**
|
|
679
683
|
* Unretweet a tweet.
|
|
680
684
|
*
|
|
681
|
-
* @param id - The
|
|
685
|
+
* @param id - The ID of the target tweet.
|
|
682
686
|
*
|
|
683
687
|
* @returns Whether unretweeting was successful or not.
|
|
684
688
|
*
|
|
685
689
|
* @example
|
|
686
|
-
*
|
|
690
|
+
*
|
|
691
|
+
* ```ts
|
|
687
692
|
* import { Rettiwt } from 'rettiwt-api';
|
|
688
693
|
*
|
|
689
694
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -714,12 +719,13 @@ export class TweetService extends FetcherService {
|
|
|
714
719
|
/**
|
|
715
720
|
* Unschedule a tweet.
|
|
716
721
|
*
|
|
717
|
-
* @param id - The
|
|
722
|
+
* @param id - The ID of the scheduled tweet.
|
|
718
723
|
*
|
|
719
724
|
* @returns Whether unscheduling was successful or not.
|
|
720
725
|
*
|
|
721
726
|
* @example
|
|
722
|
-
*
|
|
727
|
+
*
|
|
728
|
+
* ```ts
|
|
723
729
|
* import { Rettiwt } from 'rettiwt-api';
|
|
724
730
|
*
|
|
725
731
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -752,10 +758,11 @@ export class TweetService extends FetcherService {
|
|
|
752
758
|
*
|
|
753
759
|
* @param media - The path or ArrayBuffer to the media file to upload.
|
|
754
760
|
*
|
|
755
|
-
* @returns The
|
|
761
|
+
* @returns The ID of the uploaded media.
|
|
756
762
|
*
|
|
757
763
|
* @example
|
|
758
|
-
*
|
|
764
|
+
*
|
|
765
|
+
* ```ts
|
|
759
766
|
* import { Rettiwt } from 'rettiwt-api';
|
|
760
767
|
*
|
|
761
768
|
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
@@ -772,6 +779,7 @@ export class TweetService extends FetcherService {
|
|
|
772
779
|
* ```
|
|
773
780
|
*
|
|
774
781
|
* @remarks
|
|
782
|
+
*
|
|
775
783
|
* - The uploaded media exists for 24 hrs within which it can be included in a tweet to be posted.
|
|
776
784
|
* If not posted in a tweet within this period, the uploaded media is removed.
|
|
777
785
|
* - Instead of a path to the media, an ArrayBuffer containing the media can also be uploaded.
|