rettiwt-api 2.7.1 → 3.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/.eslintrc.js +73 -5
- package/.tool-versions +1 -0
- package/README.md +87 -20
- package/dist/Rettiwt.js +0 -1
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +2 -4
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +37 -0
- package/dist/collections/Extractors.js +67 -0
- package/dist/collections/Extractors.js.map +1 -0
- package/dist/collections/Groups.d.ts +19 -0
- package/dist/collections/Groups.js +55 -0
- package/dist/collections/Groups.js.map +1 -0
- package/dist/collections/Requests.d.ts +12 -0
- package/dist/collections/Requests.js +46 -0
- package/dist/collections/Requests.js.map +1 -0
- package/dist/commands/Auth.d.ts +6 -0
- package/dist/commands/Auth.js +26 -8
- package/dist/commands/Auth.js.map +1 -1
- package/dist/commands/Tweet.js +237 -82
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +197 -36
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Api.d.ts +30 -0
- package/dist/enums/Api.js +32 -1
- package/dist/enums/Api.js.map +1 -1
- package/dist/enums/Data.d.ts +9 -0
- package/dist/enums/Data.js +14 -0
- package/dist/enums/Data.js.map +1 -0
- package/dist/enums/Http.d.ts +1 -1
- package/dist/enums/Http.js +1 -1
- package/dist/enums/Logging.d.ts +6 -5
- package/dist/enums/Logging.js +6 -5
- package/dist/enums/Logging.js.map +1 -1
- package/dist/enums/Resource.d.ts +33 -0
- package/dist/enums/Resource.js +42 -0
- package/dist/enums/Resource.js.map +1 -0
- package/dist/helper/CliUtils.d.ts +1 -1
- package/dist/helper/CliUtils.js.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +129 -0
- package/dist/models/args/FetchArgs.js +263 -0
- package/dist/models/args/FetchArgs.js.map +1 -0
- package/dist/models/args/PostArgs.d.ts +116 -0
- package/dist/models/args/PostArgs.js +232 -0
- package/dist/models/args/PostArgs.js.map +1 -0
- package/dist/models/data/CursoredData.d.ts +11 -11
- package/dist/models/data/CursoredData.js +21 -16
- package/dist/models/data/CursoredData.js.map +1 -1
- package/dist/models/data/List.d.ts +8 -10
- package/dist/models/data/List.js +2 -4
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +44 -29
- package/dist/models/data/Tweet.js +74 -15
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +38 -20
- package/dist/models/data/User.js +71 -7
- package/dist/models/data/User.js.map +1 -1
- package/dist/models/errors/ApiError.d.ts +1 -3
- package/dist/models/errors/ApiError.js +1 -4
- package/dist/models/errors/ApiError.js.map +1 -1
- package/dist/models/errors/DataValidationError.d.ts +30 -0
- package/dist/models/errors/DataValidationError.js +34 -0
- package/dist/models/errors/DataValidationError.js.map +1 -0
- package/dist/models/errors/HttpError.d.ts +1 -3
- package/dist/models/errors/HttpError.js +1 -4
- package/dist/models/errors/HttpError.js.map +1 -1
- package/dist/models/errors/TimeoutError.d.ts +2 -4
- package/dist/models/errors/TimeoutError.js +2 -5
- package/dist/models/errors/TimeoutError.js.map +1 -1
- package/dist/services/internal/ErrorService.d.ts +45 -35
- package/dist/services/internal/ErrorService.js +70 -68
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/LogService.d.ts +7 -5
- package/dist/services/internal/LogService.js +28 -9
- package/dist/services/internal/LogService.js.map +1 -1
- package/dist/services/public/AuthService.d.ts +24 -20
- package/dist/services/public/AuthService.js +38 -36
- package/dist/services/public/AuthService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +89 -0
- package/dist/services/public/FetcherService.js +240 -0
- package/dist/services/public/FetcherService.js.map +1 -0
- package/dist/services/public/TweetService.d.ts +213 -94
- package/dist/services/public/TweetService.js +409 -209
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +185 -52
- package/dist/services/public/UserService.js +338 -103
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/ReturnTypes.d.ts +21 -0
- package/dist/types/ReturnTypes.js +3 -0
- package/dist/types/ReturnTypes.js.map +1 -0
- package/package.json +4 -2
- package/src/Rettiwt.ts +0 -3
- package/src/cli.ts +2 -4
- package/src/collections/Extractors.ts +84 -0
- package/src/collections/Groups.ts +54 -0
- package/src/collections/Requests.ts +52 -0
- package/src/commands/Auth.ts +19 -7
- package/src/commands/Tweet.ts +179 -91
- package/src/commands/User.ts +118 -25
- package/src/enums/Api.ts +31 -0
- package/src/enums/Data.ts +9 -0
- package/src/enums/Http.ts +1 -1
- package/src/enums/Logging.ts +6 -5
- package/src/enums/Resource.ts +40 -0
- package/src/helper/CliUtils.ts +1 -1
- package/src/index.ts +41 -14
- package/src/models/args/FetchArgs.ts +296 -0
- package/src/models/args/PostArgs.ts +263 -0
- package/src/models/data/CursoredData.ts +23 -15
- package/src/models/data/List.ts +12 -15
- package/src/models/data/Tweet.ts +108 -39
- package/src/models/data/User.ts +99 -30
- package/src/models/errors/ApiError.ts +1 -4
- package/src/models/errors/DataValidationError.ts +44 -0
- package/src/models/errors/HttpError.ts +1 -4
- package/src/models/errors/TimeoutError.ts +2 -5
- package/src/services/internal/ErrorService.ts +76 -75
- package/src/services/internal/LogService.ts +20 -10
- package/src/services/public/AuthService.ts +39 -38
- package/src/services/public/FetcherService.ts +209 -0
- package/src/services/public/TweetService.ts +384 -179
- package/src/services/public/UserService.ts +319 -86
- package/src/types/RettiwtConfig.ts +0 -1
- package/src/types/ReturnTypes.ts +24 -0
- package/dist/models/args/TweetArgs.d.ts +0 -44
- package/dist/models/args/TweetArgs.js +0 -82
- package/dist/models/args/TweetArgs.js.map +0 -1
- package/dist/models/data/Media.d.ts +0 -14
- package/dist/models/data/Media.js +0 -19
- package/dist/models/data/Media.js.map +0 -1
- package/dist/services/internal/FetcherService.d.ts +0 -106
- package/dist/services/internal/FetcherService.js +0 -365
- package/dist/services/internal/FetcherService.js.map +0 -1
- package/src/models/args/TweetArgs.ts +0 -98
- package/src/models/data/Media.ts +0 -19
- package/src/services/internal/FetcherService.ts +0 -365
package/.eslintrc.js
CHANGED
|
@@ -5,8 +5,13 @@ module.exports = {
|
|
|
5
5
|
tsconfigRootDir: __dirname,
|
|
6
6
|
sourceType: 'module',
|
|
7
7
|
},
|
|
8
|
-
plugins: ['@typescript-eslint/eslint-plugin', 'eslint-plugin-tsdoc'],
|
|
9
|
-
extends: [
|
|
8
|
+
plugins: ['@typescript-eslint/eslint-plugin', 'eslint-plugin-tsdoc', 'import'],
|
|
9
|
+
extends: [
|
|
10
|
+
'plugin:@typescript-eslint/recommended',
|
|
11
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
12
|
+
'plugin:import/recommended',
|
|
13
|
+
'plugin:import/typescript',
|
|
14
|
+
],
|
|
10
15
|
root: true,
|
|
11
16
|
env: {
|
|
12
17
|
node: true,
|
|
@@ -47,14 +52,77 @@ module.exports = {
|
|
|
47
52
|
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
48
53
|
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
|
49
54
|
'@typescript-eslint/explicit-member-accessibility': 'error',
|
|
50
|
-
'@typescript-eslint/
|
|
51
|
-
'@typescript-eslint/no-extraneous-class': [
|
|
55
|
+
'@typescript-eslint/member-ordering': [
|
|
52
56
|
'warn',
|
|
53
57
|
{
|
|
54
|
-
|
|
58
|
+
default: {
|
|
59
|
+
memberTypes: [
|
|
60
|
+
// FIELDS
|
|
61
|
+
|
|
62
|
+
// PRIVATE
|
|
63
|
+
'private-static-readonly-field',
|
|
64
|
+
'private-static-field',
|
|
65
|
+
'private-readonly-field',
|
|
66
|
+
'private-field',
|
|
67
|
+
|
|
68
|
+
// PROTECTED
|
|
69
|
+
'protected-static-readonly-field',
|
|
70
|
+
'protected-static-field',
|
|
71
|
+
'protected-readonly-field',
|
|
72
|
+
'protected-field',
|
|
73
|
+
|
|
74
|
+
// PUBLIC
|
|
75
|
+
'public-static-readonly-field',
|
|
76
|
+
'public-static-field',
|
|
77
|
+
'public-readonly-field',
|
|
78
|
+
'public-field',
|
|
79
|
+
|
|
80
|
+
// CONSTRUCTORS
|
|
81
|
+
'private-constructor',
|
|
82
|
+
'protected-constructor',
|
|
83
|
+
'public-constructor',
|
|
84
|
+
|
|
85
|
+
// METHODS
|
|
86
|
+
|
|
87
|
+
// PRIVATE
|
|
88
|
+
'private-static-method',
|
|
89
|
+
'private-method',
|
|
90
|
+
|
|
91
|
+
// PROTECTED
|
|
92
|
+
'protected-static-method',
|
|
93
|
+
'protected-method',
|
|
94
|
+
|
|
95
|
+
// PUBLIC
|
|
96
|
+
'public-static-method',
|
|
97
|
+
'public-method',
|
|
98
|
+
],
|
|
99
|
+
order: 'alphabetically',
|
|
100
|
+
},
|
|
55
101
|
},
|
|
56
102
|
],
|
|
103
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
57
104
|
'@typescript-eslint/no-inferrable-types': 'off',
|
|
58
105
|
'tsdoc/syntax': 'warn',
|
|
106
|
+
'sort-imports': [
|
|
107
|
+
'warn',
|
|
108
|
+
{
|
|
109
|
+
ignoreCase: true,
|
|
110
|
+
ignoreDeclarationSort: true,
|
|
111
|
+
ignoreMemberSort: false,
|
|
112
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
113
|
+
allowSeparatedGroups: false,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
'import/order': [
|
|
117
|
+
'warn',
|
|
118
|
+
{
|
|
119
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
|
120
|
+
alphabetize: {
|
|
121
|
+
order: 'asc',
|
|
122
|
+
caseInsensitive: true,
|
|
123
|
+
},
|
|
124
|
+
'newlines-between': 'always-and-inside-groups',
|
|
125
|
+
},
|
|
126
|
+
],
|
|
59
127
|
},
|
|
60
128
|
};
|
package/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodejs 20.11.1
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A CLI tool and an API for fetching data from Twitter for free!
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
- NodeJS 20
|
|
7
|
+
- NodeJS 20
|
|
8
8
|
- A working Twitter account (optional)
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
@@ -19,32 +19,44 @@ It is recommended to install the package globally. Use the following steps to in
|
|
|
19
19
|
|
|
20
20
|
Rettiwt-API can be used with or without logging in to Twitter. As such, the two authentication strategies are:
|
|
21
21
|
|
|
22
|
-
- 'guest' authentication (without logging in) grants access to the following resources:
|
|
22
|
+
- 'guest' authentication (without logging in) grants access to the following resources/actions:
|
|
23
23
|
|
|
24
24
|
- Tweet Details
|
|
25
25
|
- User Details
|
|
26
|
-
- User Timeline
|
|
27
|
-
- User Replies
|
|
26
|
+
- User Timeline
|
|
27
|
+
- User Replies Timeline
|
|
28
28
|
|
|
29
|
-
- 'user' authentication (logging in) grants access to the following resources:
|
|
29
|
+
- 'user' authentication (logging in) grants access to the following resources/actions:
|
|
30
30
|
|
|
31
31
|
- Tweet Details
|
|
32
|
-
- Tweet
|
|
33
|
-
- Tweet
|
|
32
|
+
- Tweet Like
|
|
33
|
+
- Tweet Likers
|
|
34
|
+
- Tweet List
|
|
35
|
+
- Tweet Post
|
|
36
|
+
- Tweet Retweet
|
|
37
|
+
- Tweet Retweeters
|
|
34
38
|
- Tweet Search
|
|
35
39
|
- Tweet Stream
|
|
36
|
-
- Tweet
|
|
40
|
+
- Tweet Unlike
|
|
41
|
+
- Tweet Unpost
|
|
42
|
+
- Tweet Unretweet
|
|
43
|
+
- Tweet Media Upload
|
|
37
44
|
- User Details
|
|
45
|
+
- User Follow
|
|
38
46
|
- User Followers
|
|
39
47
|
- User Following
|
|
48
|
+
- User Highlights
|
|
40
49
|
- User Likes
|
|
41
|
-
- User
|
|
42
|
-
- User Replies
|
|
50
|
+
- User Media
|
|
51
|
+
- User Replies Timeline
|
|
52
|
+
- User Subscriptions
|
|
53
|
+
- User Timeline
|
|
54
|
+
- User Unfollow
|
|
43
55
|
|
|
44
56
|
By default, Rettiwt-API uses 'guest' authentication. If however, access to the full set of resources is required, 'user' authentication can be used, which requires the following additional steps post-installtion:
|
|
45
57
|
|
|
46
58
|
1. Open a terminal.
|
|
47
|
-
2. Generate an API_KEY using the command `rettiwt auth login <email> <username> <password
|
|
59
|
+
2. Generate an API_KEY using the command `rettiwt auth login "<email>" "<username>" "<password>"`
|
|
48
60
|
|
|
49
61
|
Here,
|
|
50
62
|
|
|
@@ -170,11 +182,13 @@ const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
|
170
182
|
* - contain the words <word1> and <word2>
|
|
171
183
|
*
|
|
172
184
|
* 'data' is the response object received in the previous example.
|
|
185
|
+
*
|
|
186
|
+
* 'count' is a number less or equal to 20 (the quantity of tweets to return)
|
|
173
187
|
*/
|
|
174
188
|
rettiwt.tweet.search({
|
|
175
189
|
fromUsers: ['<username>'],
|
|
176
190
|
words: ['<word1>', '<word2>']
|
|
177
|
-
}, data.next.value)
|
|
191
|
+
}, count, data.next.value)
|
|
178
192
|
.then(data => {
|
|
179
193
|
...
|
|
180
194
|
})
|
|
@@ -251,6 +265,50 @@ Sometimes, when the library shows unexpected behaviour, for troubleshooting purp
|
|
|
251
265
|
const rettiwt = new Rettiwt({ apiKey: API_KEY, logging: true });
|
|
252
266
|
```
|
|
253
267
|
|
|
268
|
+
## Accessing raw response
|
|
269
|
+
|
|
270
|
+
Rettiwt-API also provides direct access to the raw response data, bypassing any preprocessing by the library itself. This can be achieved by using the [`FetcherService`](https://rishikant181.github.io/Rettiwt-API/classes/FetcherService.html) class instead of the `Rettiwt` class, as demonstrated by the example below, which fetches the raw details of a user with the username 'user1':
|
|
271
|
+
|
|
272
|
+
- ### JavaScript example:
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
import { FetcherService, EResourceType } from 'rettiwt-api';
|
|
276
|
+
|
|
277
|
+
// Creating a new FetcherService instance
|
|
278
|
+
const fetcher = new FetcherService({ apiKey: API_KEY });
|
|
279
|
+
|
|
280
|
+
// Fetching the details of the given user
|
|
281
|
+
fetcher
|
|
282
|
+
.request(EResourceType.USER_DETAILS_BY_USERNAME, { id: 'user1' })
|
|
283
|
+
.then((res) => {
|
|
284
|
+
console.log(res);
|
|
285
|
+
})
|
|
286
|
+
.catch((err) => {
|
|
287
|
+
console.log(err);
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
- ### TypeScript example:
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
import { FetcherService, EResourceType, IUserDetailsResponse } from 'rettiwt-api';
|
|
295
|
+
|
|
296
|
+
// Creating a new FetcherService instance
|
|
297
|
+
const fetcher = new FetcherService({ apiKey: API_KEY });
|
|
298
|
+
|
|
299
|
+
// Fetching the details of the given user
|
|
300
|
+
fetcher
|
|
301
|
+
.request<IUserDetailsResponse>(EResourceType.USER_DETAILS_BY_USERNAME, { id: 'user1' })
|
|
302
|
+
.then((res) => {
|
|
303
|
+
console.log(res);
|
|
304
|
+
})
|
|
305
|
+
.catch((err) => {
|
|
306
|
+
console.log(err);
|
|
307
|
+
});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
As demonstrated by the example, the raw data can be accessed by using the `request` method of the `FetcherService` class, which takes two parameters. The first parameter is the name of the requested resource, while the second is an object specifying the associated arguments required for the given resource. The complete list of resource type can be checked [here](https://rishikant181.github.io/Rettiwt-API/enums/AuthService.html#EResourceType). As for the resource specific argurments, they are the same as that of the methods of `Rettiwt` class' methods for the respective resources, but structured as an object. Notice how the `FetcherService` class takes the same arguments as the `Rettiwt` class, and the arguments have the same effects as they have in case of `Rettiwt` class.
|
|
311
|
+
|
|
254
312
|
## Features
|
|
255
313
|
|
|
256
314
|
So far, the following operations are supported:
|
|
@@ -263,23 +321,32 @@ So far, the following operations are supported:
|
|
|
263
321
|
### Tweets
|
|
264
322
|
|
|
265
323
|
- [Getting the details of a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#details)
|
|
266
|
-
- [
|
|
267
|
-
- [Getting the list of users who
|
|
324
|
+
- [Liking a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#like)
|
|
325
|
+
- [Getting the list of users who liked a given tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#likers)
|
|
268
326
|
- [Getting the list of tweets from a given Twitter list](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#list)
|
|
269
|
-
- [
|
|
270
|
-
- [
|
|
327
|
+
- [Posting a new tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#post)
|
|
328
|
+
- [Retweeting a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#retweet)
|
|
329
|
+
- [Getting the list of users who retweeted a given tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#retweeters)
|
|
271
330
|
- [Searching for the list of tweets that match a given filter](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#search)
|
|
272
331
|
- [Streaming filtered tweets in pseudo-realtime](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#stream)
|
|
273
|
-
- [
|
|
332
|
+
- [Unliking a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#unlike)
|
|
333
|
+
- [Unposting a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#unpost)
|
|
334
|
+
- [Unretweeting a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#unretweet)
|
|
335
|
+
- [Uploading a media file for a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#upload)
|
|
274
336
|
|
|
275
337
|
### Users
|
|
276
338
|
|
|
277
339
|
- [Getting the details of a user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#details)
|
|
340
|
+
- [Following a given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#follow)
|
|
278
341
|
- [Getting the list of users who follow the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#followers)
|
|
279
342
|
- [Getting the list of users who are followed by the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#following)
|
|
280
|
-
- [Getting the list of tweets
|
|
281
|
-
- [Getting the
|
|
282
|
-
- [Getting the
|
|
343
|
+
- [Getting the list of highlighted tweets of the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#highlights)
|
|
344
|
+
- [Getting the list of tweets liked by the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#likes)
|
|
345
|
+
- [Getting the media timeline of the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#media)
|
|
346
|
+
- [Getting the replies timeline of the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#replies)
|
|
347
|
+
- [Getting the list of subscriptions of the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#subscriptions)
|
|
348
|
+
- [Getting the tweet timeline of the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#timeline)
|
|
349
|
+
- [Unfollowing a given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#unfollow)
|
|
283
350
|
|
|
284
351
|
## CLI Usage
|
|
285
352
|
|
package/dist/Rettiwt.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Rettiwt = void 0;
|
|
4
|
-
// SERVICES
|
|
5
4
|
var AuthService_1 = require("./services/public/AuthService");
|
|
6
5
|
var TweetService_1 = require("./services/public/TweetService");
|
|
7
6
|
var UserService_1 = require("./services/public/UserService");
|
package/dist/Rettiwt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rettiwt.js","sourceRoot":"","sources":["../src/Rettiwt.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Rettiwt.js","sourceRoot":"","sources":["../src/Rettiwt.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAC5D,+DAA8D;AAC9D,6DAA4D;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH;IAUC;;;;OAIG;IACH,iBAAmB,MAAuB;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IACF,cAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,0BAAO"}
|
package/dist/cli.js
CHANGED
|
@@ -5,13 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
var _a;
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
// PACKAGES
|
|
9
8
|
var commander_1 = require("commander");
|
|
10
|
-
var
|
|
11
|
-
// SUB-COMMANDS
|
|
9
|
+
var Auth_1 = __importDefault(require("./commands/Auth"));
|
|
12
10
|
var Tweet_1 = __importDefault(require("./commands/Tweet"));
|
|
13
11
|
var User_1 = __importDefault(require("./commands/User"));
|
|
14
|
-
var
|
|
12
|
+
var Rettiwt_1 = require("./Rettiwt");
|
|
15
13
|
// Creating a new commandline program
|
|
16
14
|
var program = (0, commander_1.createCommand)('rettiwt')
|
|
17
15
|
.description('A CLI tool for accessing the Twitter API for free!')
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;AAEA,uCAA0C;AAE1C,yDAAm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C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IInitializeMediaUploadResponse, IListTweetsResponse, ITweetDetailsResponse, ITweetLikeResponse, ITweetLikersResponse, ITweetPostResponse, ITweetRetweetersResponse, ITweetRetweetResponse, ITweetSearchResponse, ITweetUnlikeResponse, ITweetUnpostResponse, ITweetUnretweetResponse, IUserDetailsResponse, IUserFollowersResponse, IUserFollowingResponse, IUserFollowResponse, IUserHighlightsResponse, IUserLikesResponse, IUserMediaResponse, IUserSubscriptionsResponse, IUserTweetsAndRepliesResponse, IUserTweetsResponse, IUserUnfollowResponse } from 'rettiwt-core';
|
|
2
|
+
import { CursoredData } from '../models/data/CursoredData';
|
|
3
|
+
import { Tweet } from '../models/data/Tweet';
|
|
4
|
+
import { User } from '../models/data/User';
|
|
5
|
+
/**
|
|
6
|
+
* Collection of data extractors for each resource.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const extractors: {
|
|
11
|
+
LIST_TWEETS: (response: IListTweetsResponse) => CursoredData<Tweet>;
|
|
12
|
+
MEDIA_UPLOAD_APPEND: () => void;
|
|
13
|
+
MEDIA_UPLOAD_FINALIZE: () => void;
|
|
14
|
+
MEDIA_UPLOAD_INITIALIZE: (response: IInitializeMediaUploadResponse) => string;
|
|
15
|
+
TWEET_DETAILS: (response: ITweetDetailsResponse, id: string) => Tweet | undefined;
|
|
16
|
+
TWEET_LIKE: (response: ITweetLikeResponse) => boolean;
|
|
17
|
+
TWEET_LIKERS: (response: ITweetLikersResponse) => CursoredData<User>;
|
|
18
|
+
TWEET_POST: (response: ITweetPostResponse) => string;
|
|
19
|
+
TWEET_RETWEET: (response: ITweetRetweetResponse) => boolean;
|
|
20
|
+
TWEET_RETWEETERS: (response: ITweetRetweetersResponse) => CursoredData<User>;
|
|
21
|
+
TWEET_SEARCH: (response: ITweetSearchResponse) => CursoredData<Tweet>;
|
|
22
|
+
TWEET_UNLIKE: (response: ITweetUnlikeResponse) => boolean;
|
|
23
|
+
TWEET_UNPOST: (response: ITweetUnpostResponse) => boolean;
|
|
24
|
+
TWEET_UNRETWEET: (response: ITweetUnretweetResponse) => boolean;
|
|
25
|
+
USER_DETAILS_BY_USERNAME: (response: IUserDetailsResponse) => User | undefined;
|
|
26
|
+
USER_DETAILS_BY_ID: (response: IUserDetailsResponse) => User | undefined;
|
|
27
|
+
USER_FOLLOW: (response: IUserFollowResponse) => boolean;
|
|
28
|
+
USER_FOLLOWING: (response: IUserFollowingResponse) => CursoredData<User>;
|
|
29
|
+
USER_FOLLOWERS: (response: IUserFollowersResponse) => CursoredData<User>;
|
|
30
|
+
USER_HIGHLIGHTS: (response: IUserHighlightsResponse) => CursoredData<Tweet>;
|
|
31
|
+
USER_LIKES: (response: IUserLikesResponse) => CursoredData<Tweet>;
|
|
32
|
+
USER_MEDIA: (response: IUserMediaResponse) => CursoredData<Tweet>;
|
|
33
|
+
USER_SUBSCRIPTIONS: (response: IUserSubscriptionsResponse) => CursoredData<User>;
|
|
34
|
+
USER_TIMELINE: (response: IUserTweetsResponse) => CursoredData<Tweet>;
|
|
35
|
+
USER_TIMELINE_AND_REPLIES: (response: IUserTweetsAndRepliesResponse) => CursoredData<Tweet>;
|
|
36
|
+
USER_UNFOLLOW: (response: IUserUnfollowResponse) => boolean;
|
|
37
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractors = void 0;
|
|
4
|
+
var Data_1 = require("../enums/Data");
|
|
5
|
+
var CursoredData_1 = require("../models/data/CursoredData");
|
|
6
|
+
var Tweet_1 = require("../models/data/Tweet");
|
|
7
|
+
var User_1 = require("../models/data/User");
|
|
8
|
+
/**
|
|
9
|
+
* Collection of data extractors for each resource.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
exports.extractors = {
|
|
14
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
15
|
+
LIST_TWEETS: function (response) {
|
|
16
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.TWEET);
|
|
17
|
+
},
|
|
18
|
+
MEDIA_UPLOAD_APPEND: function () { return undefined; },
|
|
19
|
+
MEDIA_UPLOAD_FINALIZE: function () { return undefined; },
|
|
20
|
+
MEDIA_UPLOAD_INITIALIZE: function (response) { var _a; return (_a = response.media_id_string) !== null && _a !== void 0 ? _a : undefined; },
|
|
21
|
+
TWEET_DETAILS: function (response, id) { return Tweet_1.Tweet.single(response, id); },
|
|
22
|
+
TWEET_LIKE: function (response) { var _a; return (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.favorite_tweet) ? true : false); },
|
|
23
|
+
TWEET_LIKERS: function (response) {
|
|
24
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.USER);
|
|
25
|
+
},
|
|
26
|
+
TWEET_POST: function (response) { var _a, _b, _c, _d, _e; return (_e = (_d = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.create_tweet) === null || _b === void 0 ? void 0 : _b.tweet_results) === null || _c === void 0 ? void 0 : _c.result) === null || _d === void 0 ? void 0 : _d.rest_id) !== null && _e !== void 0 ? _e : undefined; },
|
|
27
|
+
TWEET_RETWEET: function (response) { var _a; return (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.create_retweet) ? true : false); },
|
|
28
|
+
TWEET_RETWEETERS: function (response) {
|
|
29
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.USER);
|
|
30
|
+
},
|
|
31
|
+
TWEET_SEARCH: function (response) {
|
|
32
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.TWEET);
|
|
33
|
+
},
|
|
34
|
+
TWEET_UNLIKE: function (response) { var _a; return (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.unfavorite_tweet) ? true : false); },
|
|
35
|
+
TWEET_UNPOST: function (response) { var _a; return (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.delete_tweet) ? true : false); },
|
|
36
|
+
TWEET_UNRETWEET: function (response) { var _a, _b, _c; return ((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.unretweet) === null || _b === void 0 ? void 0 : _b.source_tweet_results) === null || _c === void 0 ? void 0 : _c.result) ? true : false; },
|
|
37
|
+
USER_DETAILS_BY_USERNAME: function (response) { return User_1.User.single(response); },
|
|
38
|
+
USER_DETAILS_BY_ID: function (response) { return User_1.User.single(response); },
|
|
39
|
+
USER_FOLLOW: function (response) { return ((response === null || response === void 0 ? void 0 : response.id) ? true : false); },
|
|
40
|
+
USER_FOLLOWING: function (response) {
|
|
41
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.USER);
|
|
42
|
+
},
|
|
43
|
+
USER_FOLLOWERS: function (response) {
|
|
44
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.USER);
|
|
45
|
+
},
|
|
46
|
+
USER_HIGHLIGHTS: function (response) {
|
|
47
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.TWEET);
|
|
48
|
+
},
|
|
49
|
+
USER_LIKES: function (response) {
|
|
50
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.TWEET);
|
|
51
|
+
},
|
|
52
|
+
USER_MEDIA: function (response) {
|
|
53
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.TWEET);
|
|
54
|
+
},
|
|
55
|
+
USER_SUBSCRIPTIONS: function (response) {
|
|
56
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.USER);
|
|
57
|
+
},
|
|
58
|
+
USER_TIMELINE: function (response) {
|
|
59
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.TWEET);
|
|
60
|
+
},
|
|
61
|
+
USER_TIMELINE_AND_REPLIES: function (response) {
|
|
62
|
+
return new CursoredData_1.CursoredData(response, Data_1.EBaseType.TWEET);
|
|
63
|
+
},
|
|
64
|
+
USER_UNFOLLOW: function (response) { return ((response === null || response === void 0 ? void 0 : response.id) ? true : false); },
|
|
65
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=Extractors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Extractors.js","sourceRoot":"","sources":["../../src/collections/Extractors.ts"],"names":[],"mappings":";;;AA0BA,sCAA0C;AAC1C,4DAA2D;AAC3D,8CAA6C;AAC7C,4CAA2C;AAE3C;;;;GAIG;AACU,QAAA,UAAU,GAAG;IACzB,yDAAyD;IACzD,WAAW,EAAE,UAAC,QAA6B;QAC1C,OAAA,IAAI,2BAAY,CAAQ,QAAQ,EAAE,gBAAS,CAAC,KAAK,CAAC;IAAlD,CAAkD;IAEnD,mBAAmB,EAAE,cAAY,OAAA,SAAS,EAAT,CAAS;IAC1C,qBAAqB,EAAE,cAAY,OAAA,SAAS,EAAT,CAAS;IAC5C,uBAAuB,EAAE,UAAC,QAAwC,YACjE,OAAA,MAAA,QAAQ,CAAC,eAAe,mCAAI,SAAS,CAAA,EAAA;IAEtC,aAAa,EAAE,UAAC,QAA+B,EAAE,EAAU,IAAwB,OAAA,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,EAA1B,CAA0B;IAC7G,UAAU,EAAE,UAAC,QAA4B,YAAc,OAAA,CAAC,CAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,cAAc,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA,EAAA;IACtG,YAAY,EAAE,UAAC,QAA8B;QAC5C,OAAA,IAAI,2BAAY,CAAO,QAAQ,EAAE,gBAAS,CAAC,IAAI,CAAC;IAAhD,CAAgD;IACjD,UAAU,EAAE,UAAC,QAA4B,4BACxC,OAA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CAAC;IAAlD,CAAkD;IACnD,aAAa,EAAE,UAAC,QAA+B,IAAc,OAAA,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,EAAE,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAA7B,CAA6B;IAC1F,wDAAwD;CACxD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EResourceType } from '../enums/Resource';
|
|
2
|
+
/**
|
|
3
|
+
* Collection of resources that allow guest authentication.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const allowGuestAuthentication: EResourceType[];
|
|
8
|
+
/**
|
|
9
|
+
* Collection of resources that can be fetched.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const fetchResources: EResourceType[];
|
|
14
|
+
/**
|
|
15
|
+
* Collection of resources that can be posted.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare const postResources: EResourceType[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postResources = exports.fetchResources = exports.allowGuestAuthentication = void 0;
|
|
4
|
+
var Resource_1 = require("../enums/Resource");
|
|
5
|
+
/**
|
|
6
|
+
* Collection of resources that allow guest authentication.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
exports.allowGuestAuthentication = [
|
|
11
|
+
Resource_1.EResourceType.TWEET_DETAILS,
|
|
12
|
+
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
13
|
+
Resource_1.EResourceType.USER_TIMELINE,
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Collection of resources that can be fetched.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
exports.fetchResources = [
|
|
21
|
+
Resource_1.EResourceType.LIST_TWEETS,
|
|
22
|
+
Resource_1.EResourceType.TWEET_DETAILS,
|
|
23
|
+
Resource_1.EResourceType.TWEET_LIKERS,
|
|
24
|
+
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
25
|
+
Resource_1.EResourceType.TWEET_SEARCH,
|
|
26
|
+
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
27
|
+
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
28
|
+
Resource_1.EResourceType.USER_FOLLOWING,
|
|
29
|
+
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
30
|
+
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
31
|
+
Resource_1.EResourceType.USER_LIKES,
|
|
32
|
+
Resource_1.EResourceType.USER_MEDIA,
|
|
33
|
+
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
34
|
+
Resource_1.EResourceType.USER_TIMELINE,
|
|
35
|
+
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* Collection of resources that can be posted.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
exports.postResources = [
|
|
43
|
+
Resource_1.EResourceType.MEDIA_UPLOAD_APPEND,
|
|
44
|
+
Resource_1.EResourceType.MEDIA_UPLOAD_FINALIZE,
|
|
45
|
+
Resource_1.EResourceType.MEDIA_UPLOAD_INITIALIZE,
|
|
46
|
+
Resource_1.EResourceType.TWEET_LIKE,
|
|
47
|
+
Resource_1.EResourceType.TWEET_POST,
|
|
48
|
+
Resource_1.EResourceType.TWEET_RETWEET,
|
|
49
|
+
Resource_1.EResourceType.TWEET_UNLIKE,
|
|
50
|
+
Resource_1.EResourceType.TWEET_UNPOST,
|
|
51
|
+
Resource_1.EResourceType.TWEET_UNRETWEET,
|
|
52
|
+
Resource_1.EResourceType.USER_FOLLOW,
|
|
53
|
+
Resource_1.EResourceType.USER_UNFOLLOW,
|
|
54
|
+
];
|
|
55
|
+
//# sourceMappingURL=Groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Groups.js","sourceRoot":"","sources":["../../src/collections/Groups.ts"],"names":[],"mappings":";;;AAAA,8CAAkD;AAElD;;;;GAIG;AACU,QAAA,wBAAwB,GAAG;IACvC,wBAAa,CAAC,aAAa;IAC3B,wBAAa,CAAC,wBAAwB;IACtC,wBAAa,CAAC,aAAa;CAC3B,CAAC;AAEF;;;;GAIG;AACU,QAAA,cAAc,GAAG;IAC7B,wBAAa,CAAC,WAAW;IACzB,wBAAa,CAAC,aAAa;IAC3B,wBAAa,CAAC,YAAY;IAC1B,wBAAa,CAAC,gBAAgB;IAC9B,wBAAa,CAAC,YAAY;IAC1B,wBAAa,CAAC,wBAAwB;IACtC,wBAAa,CAAC,kBAAkB;IAChC,wBAAa,CAAC,cAAc;IAC5B,wBAAa,CAAC,cAAc;IAC5B,wBAAa,CAAC,eAAe;IAC7B,wBAAa,CAAC,UAAU;IACxB,wBAAa,CAAC,UAAU;IACxB,wBAAa,CAAC,kBAAkB;IAChC,wBAAa,CAAC,aAAa;IAC3B,wBAAa,CAAC,yBAAyB;CACvC,CAAC;AAEF;;;;GAIG;AACU,QAAA,aAAa,GAAG;IAC5B,wBAAa,CAAC,mBAAmB;IACjC,wBAAa,CAAC,qBAAqB;IACnC,wBAAa,CAAC,uBAAuB;IACrC,wBAAa,CAAC,UAAU;IACxB,wBAAa,CAAC,UAAU;IACxB,wBAAa,CAAC,aAAa;IAC3B,wBAAa,CAAC,YAAY;IAC1B,wBAAa,CAAC,YAAY;IAC1B,wBAAa,CAAC,eAAe;IAC7B,wBAAa,CAAC,WAAW;IACzB,wBAAa,CAAC,aAAa;CAC3B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { EResourceType } from '../enums/Resource';
|
|
3
|
+
import { FetchArgs } from '../models/args/FetchArgs';
|
|
4
|
+
import { PostArgs } from '../models/args/PostArgs';
|
|
5
|
+
/**
|
|
6
|
+
* The collection of requests to various resources.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const requests: {
|
|
11
|
+
[key in keyof typeof EResourceType]: (args: FetchArgs | PostArgs) => AxiosRequestConfig;
|
|
12
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requests = void 0;
|
|
4
|
+
var rettiwt_core_1 = require("rettiwt-core");
|
|
5
|
+
/**
|
|
6
|
+
* The request generator from rettiwt-core.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
var request = new rettiwt_core_1.Request();
|
|
11
|
+
/**
|
|
12
|
+
* The collection of requests to various resources.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
exports.requests = {
|
|
17
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
18
|
+
LIST_TWEETS: function (args) { return request.list.tweets(args.id, args.count, args.cursor); },
|
|
19
|
+
MEDIA_UPLOAD_APPEND: function (args) { return request.media.appendUpload(args.upload.id, args.upload.media); },
|
|
20
|
+
MEDIA_UPLOAD_FINALIZE: function (args) { return request.media.finalizeUpload(args.upload.id); },
|
|
21
|
+
MEDIA_UPLOAD_INITIALIZE: function (args) { return request.media.initializeUpload(args.upload.size); },
|
|
22
|
+
TWEET_DETAILS: function (args) { return request.tweet.details(args.id); },
|
|
23
|
+
TWEET_LIKE: function (args) { return request.tweet.like(args.id); },
|
|
24
|
+
TWEET_LIKERS: function (args) { return request.tweet.likers(args.id, args.count, args.cursor); },
|
|
25
|
+
TWEET_POST: function (args) { return request.tweet.post(args.tweet); },
|
|
26
|
+
TWEET_RETWEET: function (args) { return request.tweet.retweet(args.id); },
|
|
27
|
+
TWEET_RETWEETERS: function (args) { return request.tweet.retweeters(args.id, args.count, args.cursor); },
|
|
28
|
+
TWEET_SEARCH: function (args) { return request.tweet.search(args.filter, args.count, args.cursor); },
|
|
29
|
+
TWEET_UNLIKE: function (args) { return request.tweet.unlike(args.id); },
|
|
30
|
+
TWEET_UNPOST: function (args) { return request.tweet.unpost(args.id); },
|
|
31
|
+
TWEET_UNRETWEET: function (args) { return request.tweet.unretweet(args.id); },
|
|
32
|
+
USER_DETAILS_BY_USERNAME: function (args) { return request.user.detailsByUsername(args.id); },
|
|
33
|
+
USER_DETAILS_BY_ID: function (args) { return request.user.detailsById(args.id); },
|
|
34
|
+
USER_FOLLOW: function (args) { return request.user.follow(args.id); },
|
|
35
|
+
USER_FOLLOWING: function (args) { return request.user.following(args.id, args.count, args.cursor); },
|
|
36
|
+
USER_FOLLOWERS: function (args) { return request.user.followers(args.id, args.count, args.cursor); },
|
|
37
|
+
USER_HIGHLIGHTS: function (args) { return request.user.highlights(args.id, args.count, args.cursor); },
|
|
38
|
+
USER_LIKES: function (args) { return request.user.likes(args.id, args.count, args.cursor); },
|
|
39
|
+
USER_MEDIA: function (args) { return request.user.media(args.id, args.count, args.cursor); },
|
|
40
|
+
USER_SUBSCRIPTIONS: function (args) { return request.user.subscriptions(args.id, args.count, args.cursor); },
|
|
41
|
+
USER_TIMELINE: function (args) { return request.user.tweets(args.id, args.count, args.cursor); },
|
|
42
|
+
USER_TIMELINE_AND_REPLIES: function (args) { return request.user.tweetsAndReplies(args.id, args.count, args.cursor); },
|
|
43
|
+
USER_UNFOLLOW: function (args) { return request.user.unfollow(args.id); },
|
|
44
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=Requests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Requests.js","sourceRoot":"","sources":["../../src/collections/Requests.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AAMvC;;;;GAIG;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EAAhE,CAAgE;IAChH,aAAa,EAAE,UAAC,IAAc,IAAK,OAAA,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAG,CAAC,EAA/B,CAA+B;IAClE,wDAAwD;CACxD,CAAC"}
|
package/dist/commands/Auth.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { Rettiwt } from '../Rettiwt';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new 'auth' command which uses the given Rettiwt instance.
|
|
5
|
+
*
|
|
6
|
+
* @param rettiwt - The Rettiwt instance to use.
|
|
7
|
+
* @returns The created 'auth' command.
|
|
8
|
+
*/
|
|
3
9
|
declare function createAuthCommand(rettiwt: Rettiwt): Command;
|
|
4
10
|
export default createAuthCommand;
|