rettiwt-api 2.3.0 → 2.4.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 +81 -13
- package/dist/Rettiwt.d.ts +37 -1
- package/dist/Rettiwt.js +37 -1
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +39 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/Auth.d.ts +3 -0
- package/dist/commands/Auth.js +90 -0
- package/dist/commands/Auth.js.map +1 -0
- package/dist/commands/Tweet.d.ts +10 -0
- package/dist/commands/Tweet.js +242 -0
- package/dist/commands/Tweet.js.map +1 -0
- package/dist/commands/User.d.ts +10 -0
- package/dist/commands/User.js +162 -0
- package/dist/commands/User.js.map +1 -0
- package/dist/helper/CliUtils.d.ts +6 -0
- package/dist/helper/CliUtils.js +20 -0
- package/dist/helper/CliUtils.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/models/internal/RettiwtConfig.d.ts +1 -3
- package/dist/models/internal/RettiwtConfig.js +1 -0
- package/dist/models/internal/RettiwtConfig.js.map +1 -1
- package/dist/models/public/CursoredData.d.ts +0 -3
- package/dist/models/public/CursoredData.js +0 -1
- package/dist/models/public/CursoredData.js.map +1 -1
- package/dist/models/public/List.d.ts +0 -7
- package/dist/models/public/List.js.map +1 -1
- package/dist/models/public/Tweet.d.ts +0 -20
- package/dist/models/public/Tweet.js +0 -4
- package/dist/models/public/Tweet.js.map +1 -1
- package/dist/models/public/User.d.ts +0 -14
- package/dist/models/public/User.js.map +1 -1
- package/dist/services/internal/FetcherService.d.ts +7 -0
- package/dist/services/internal/FetcherService.js +25 -1
- package/dist/services/internal/FetcherService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +138 -0
- package/dist/services/public/TweetService.js +138 -0
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +122 -1
- package/dist/services/public/UserService.js +122 -1
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/internal/RettiwtConfig.d.ts +2 -0
- package/package.json +6 -2
- package/src/Rettiwt.ts +37 -1
- package/src/cli.ts +40 -0
- package/src/commands/Auth.ts +45 -0
- package/src/commands/Tweet.ts +163 -0
- package/src/commands/User.ts +85 -0
- package/src/helper/CliUtils.ts +15 -0
- package/src/index.ts +2 -0
- package/src/models/internal/RettiwtConfig.ts +2 -5
- package/src/models/public/CursoredData.ts +0 -4
- package/src/models/public/List.ts +0 -13
- package/src/models/public/Tweet.ts +0 -37
- package/src/models/public/User.ts +0 -27
- package/src/services/internal/FetcherService.ts +28 -1
- package/src/services/public/TweetService.ts +138 -0
- package/src/services/public/UserService.ts +122 -1
- package/src/types/internal/RettiwtConfig.ts +3 -0
package/README.md
CHANGED
|
@@ -4,9 +4,40 @@ An API for fetching data from Twitter for free!
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
- NodeJS
|
|
7
|
+
- NodeJS 20.10.0
|
|
8
8
|
- A working Twitter account
|
|
9
9
|
|
|
10
|
+
## Types of Authentication
|
|
11
|
+
|
|
12
|
+
Rettiwt can be used with or without logging in to Twitter. As such, the two authentication strategies are:
|
|
13
|
+
|
|
14
|
+
- 'guest' authentication (without logging in) grants access to the following resources:
|
|
15
|
+
|
|
16
|
+
- Tweet Details
|
|
17
|
+
- User Details
|
|
18
|
+
- User Timeline (tweets timeline)
|
|
19
|
+
- User Replies (replies timeline)
|
|
20
|
+
|
|
21
|
+
- 'user' authentication (logging in) grants access to the following resources:
|
|
22
|
+
|
|
23
|
+
- Tweet Details
|
|
24
|
+
- Tweet Favoriters (likes)
|
|
25
|
+
- Tweet Retweeters (retweets)
|
|
26
|
+
- Tweet Search
|
|
27
|
+
- Tweet List
|
|
28
|
+
- User Details
|
|
29
|
+
- User Followers
|
|
30
|
+
- User Following
|
|
31
|
+
- User Likes
|
|
32
|
+
- User Timeline (tweets timeline)
|
|
33
|
+
- User Replies (replies timeline)
|
|
34
|
+
|
|
35
|
+
## Notes for non-programmers
|
|
36
|
+
|
|
37
|
+
- If you have no idea of programming, it's recommended to use the CLI.
|
|
38
|
+
- The CLI provides an easy to use interface which does not require any knowledge of JavaScript or programming
|
|
39
|
+
- Please skip to 'CLI-Usage' section for details.
|
|
40
|
+
|
|
10
41
|
## Installation
|
|
11
42
|
|
|
12
43
|
1. Initialize a new Node.JS project using the command `npm init`.
|
|
@@ -18,8 +49,8 @@ Although the above process initializes a new project, that is, in fact, not nece
|
|
|
18
49
|
|
|
19
50
|
## Getting started
|
|
20
51
|
|
|
21
|
-
1. Generate credentials using
|
|
22
|
-
2.
|
|
52
|
+
1. Generate credentials using the command `npx rettiwt auth login <email> <username> <password>` in a terminal in the root of your project.
|
|
53
|
+
2. The generated string is the API_KEY.
|
|
23
54
|
3. Create a new instance of Rettiwt, passing in the API key as a config object:
|
|
24
55
|
`const rettiwt = Rettiwt({ apiKey: API_KEY });`
|
|
25
56
|
The available options in the config object can be found [here](https://rishikant181.github.io/Rettiwt-API/classes/RettiwtConfig.html).
|
|
@@ -27,12 +58,22 @@ Although the above process initializes a new project, that is, in fact, not nece
|
|
|
27
58
|
|
|
28
59
|
**Notes:**
|
|
29
60
|
|
|
30
|
-
- The API_KEY
|
|
61
|
+
- The API_KEY that we generated, is a very sensitive information and provides all access to the Twitter account. Therefore, it is generally recommended to store it as an environment variable and use it from there.
|
|
62
|
+
|
|
63
|
+
- The given example above uses 'user' authentication by using an API_KEY generated from the Twitter account.
|
|
64
|
+
|
|
65
|
+
- It's also possible to use this package without using a Twitter account, by omitting the 'apiKey' parameter in the config object. However, in this case, 'guest' authentication is used.
|
|
66
|
+
|
|
67
|
+
## The 'Rettiwt' class
|
|
68
|
+
|
|
69
|
+
The 'Rettiwt' class is entry point for accessing the Twitter API.
|
|
70
|
+
|
|
71
|
+
The 'Rettiwt' class has two members:
|
|
72
|
+
|
|
73
|
+
- 'tweet' member, for accessing resources related to tweets
|
|
74
|
+
- 'user' member, for accessing resources related to users
|
|
31
75
|
|
|
32
|
-
|
|
33
|
-
- Getting the details of a user (by username)
|
|
34
|
-
- Getting the details of a tweet
|
|
35
|
-
- Getting the tweet timeline of a user (only most recent 100 entries)
|
|
76
|
+
For details regarding usage of these members for accessing the Twitter API, refer to the 'Features' section.
|
|
36
77
|
|
|
37
78
|
## Usage
|
|
38
79
|
|
|
@@ -40,7 +81,7 @@ The following examples may help you to get started using the library:
|
|
|
40
81
|
|
|
41
82
|
### 1. Getting the details of a target Twitter user
|
|
42
83
|
|
|
43
|
-
```
|
|
84
|
+
```js
|
|
44
85
|
const { Rettiwt } = require('rettiwt-api');
|
|
45
86
|
|
|
46
87
|
// Creating a new Rettiwt instance using the API_KEY
|
|
@@ -58,7 +99,7 @@ rettiwt.user.details('<username>')
|
|
|
58
99
|
|
|
59
100
|
### 2. Getting the list of tweets that match a given filter
|
|
60
101
|
|
|
61
|
-
```
|
|
102
|
+
```js
|
|
62
103
|
const { Rettiwt } = require('rettiwt-api');
|
|
63
104
|
|
|
64
105
|
// Creating a new Rettiwt instance using the API_KEY
|
|
@@ -85,7 +126,7 @@ rettiwt.tweet.search({
|
|
|
85
126
|
|
|
86
127
|
The previous example fetches the the list of tweets matching the given filter. Since no count is specified, in this case, a default of 20 such Tweets are fetched initially. The following example demonstrates how to use the [cursor string](https://rishikant181.github.io/Rettiwt-API/classes/Cursor.html#value) obtained from the [response](https://rishikant181.github.io/Rettiwt-API/classes/CursoredData.html) object's [next](https://rishikant181.github.io/Rettiwt-API/classes/CursoredData.html#next) field, from the previous example, to fetch the next batch of tweets:
|
|
87
128
|
|
|
88
|
-
```
|
|
129
|
+
```js
|
|
89
130
|
const { Rettiwt } = require('rettiwt-api');
|
|
90
131
|
|
|
91
132
|
// Creating a new Rettiwt instance using the API_KEY
|
|
@@ -116,7 +157,7 @@ For more information regarding the different available filter options, please re
|
|
|
116
157
|
|
|
117
158
|
For masking of IP address using a proxy server, use the following code snippet for instantiation of Rettiwt:
|
|
118
159
|
|
|
119
|
-
```
|
|
160
|
+
```js
|
|
120
161
|
/**
|
|
121
162
|
* PROXY_URL is the URL or configuration for the proxy server you want to use.`
|
|
122
163
|
*/
|
|
@@ -129,7 +170,7 @@ This creates a Rettiwt instance which uses the given proxy server for making req
|
|
|
129
170
|
|
|
130
171
|
Sometimes, when the library shows unexpected behaviour, for troubleshooting purposes, debug logs can be enabled which will help in tracking down the issue and working on a potential fix. Currently, debug logs are printed to the console and are enabled by setting the 'logging' property of the config to true, while creating an instance of Rettiwt:
|
|
131
172
|
|
|
132
|
-
```
|
|
173
|
+
```js
|
|
133
174
|
/**
|
|
134
175
|
* By default, is no value for 'logging' is supplied, logging is disabled.
|
|
135
176
|
*/
|
|
@@ -160,6 +201,33 @@ So far, the following operations are supported:
|
|
|
160
201
|
- [Getting the tweet timeline of a user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#timeline)
|
|
161
202
|
- [Getting the reply timeline of a user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#replies)
|
|
162
203
|
|
|
204
|
+
## CLI Usage
|
|
205
|
+
|
|
206
|
+
Rettiwt-API also provides an easy to use command-line interface which does not require any programming knowledge.
|
|
207
|
+
|
|
208
|
+
### Installation
|
|
209
|
+
|
|
210
|
+
1. Install the recommended version of NodeJS specified in the 'Prerequisites' section.
|
|
211
|
+
2. Open a terminal.
|
|
212
|
+
3. Install the package globally using the command `npm install -g rettiwt-api`.
|
|
213
|
+
4. Use the command `rettiwt help` to ensure that the package has been installed correctly.
|
|
214
|
+
|
|
215
|
+
### Authentication
|
|
216
|
+
|
|
217
|
+
By default, the CLI operates in 'guest' authentication. If you want to use 'user' authentication:
|
|
218
|
+
|
|
219
|
+
1. Generate an API_KEY using the command `rettiwt auth login <email> <username> <password>`.
|
|
220
|
+
2. Store the output API_KEY as an environment variable with the name 'API_KEY'.
|
|
221
|
+
- Additionaly, store the API_KEY in a file for later use.
|
|
222
|
+
- Make sure to generate an API_KEY only once, and use it every time you need it.
|
|
223
|
+
3. The CLI automatically reads this environment variable to authenticate against Twitter.
|
|
224
|
+
- Additionaly, the API_KEY can also be passed in manually using the '-k' option as follows: `rettiwt -k <API_KEY> <command>`
|
|
225
|
+
|
|
226
|
+
### Help
|
|
227
|
+
|
|
228
|
+
- For help regarding the available commands, use the command `rettiwt help`
|
|
229
|
+
- For help regarding a specific command, use the command `rettiwt help <command_name>`
|
|
230
|
+
|
|
163
231
|
## API Reference
|
|
164
232
|
|
|
165
233
|
The complete API reference can be found at [this](https://rishikant181.github.io/Rettiwt-API/) page.
|
package/dist/Rettiwt.d.ts
CHANGED
|
@@ -2,7 +2,43 @@ import { TweetService } from './services/public/TweetService';
|
|
|
2
2
|
import { UserService } from './services/public/UserService';
|
|
3
3
|
import { RettiwtConfig } from './models/internal/RettiwtConfig';
|
|
4
4
|
/**
|
|
5
|
-
* The class for
|
|
5
|
+
* The class for accessing Twitter API.
|
|
6
|
+
*
|
|
7
|
+
* The created Rettiwt instance can be configured by passing in a configuration object to the constructor.
|
|
8
|
+
*
|
|
9
|
+
* For details regarding the available configuration options, refer to {@link RettiwtConfig}
|
|
10
|
+
*
|
|
11
|
+
* @example Creating a Rettiwt instance with 'guest' authentication:
|
|
12
|
+
* ```
|
|
13
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
14
|
+
*
|
|
15
|
+
* // Creating a new Rettiwt instance
|
|
16
|
+
* const rettiwt = new Rettiwt();
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example Creating a Rettiwt instance with 'guest' authentication, using a pre-generated guest key:
|
|
20
|
+
* ```
|
|
21
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
22
|
+
*
|
|
23
|
+
* // Creating a new Rettiwt instance
|
|
24
|
+
* const rettiwt = new Rettiwt({ guestKey: 'GUEST_KEY' });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Creating a Rettiwt instance with 'user' authentication:
|
|
28
|
+
* ```
|
|
29
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
30
|
+
*
|
|
31
|
+
* // Creating a new Rettiwt instance
|
|
32
|
+
* const rettiwt = new Rettiwt({ apiKey: 'API_KEY' });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Creating a Rettiwt instance with 'user'authentication, along with enabling debug logs and using a proxy:
|
|
36
|
+
* ```
|
|
37
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
38
|
+
*
|
|
39
|
+
* // Creating a new Rettiwt instance
|
|
40
|
+
* const rettiwt = new Rettiwt({ apiKey: 'API_KEY', loggin: true, proxyUrl: 'URL_TO_PROXY_SERVER' });
|
|
41
|
+
* ```
|
|
6
42
|
*
|
|
7
43
|
* @public
|
|
8
44
|
*/
|
package/dist/Rettiwt.js
CHANGED
|
@@ -5,7 +5,43 @@ exports.Rettiwt = void 0;
|
|
|
5
5
|
var TweetService_1 = require("./services/public/TweetService");
|
|
6
6
|
var UserService_1 = require("./services/public/UserService");
|
|
7
7
|
/**
|
|
8
|
-
* The class for
|
|
8
|
+
* The class for accessing Twitter API.
|
|
9
|
+
*
|
|
10
|
+
* The created Rettiwt instance can be configured by passing in a configuration object to the constructor.
|
|
11
|
+
*
|
|
12
|
+
* For details regarding the available configuration options, refer to {@link RettiwtConfig}
|
|
13
|
+
*
|
|
14
|
+
* @example Creating a Rettiwt instance with 'guest' authentication:
|
|
15
|
+
* ```
|
|
16
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
17
|
+
*
|
|
18
|
+
* // Creating a new Rettiwt instance
|
|
19
|
+
* const rettiwt = new Rettiwt();
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example Creating a Rettiwt instance with 'guest' authentication, using a pre-generated guest key:
|
|
23
|
+
* ```
|
|
24
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
25
|
+
*
|
|
26
|
+
* // Creating a new Rettiwt instance
|
|
27
|
+
* const rettiwt = new Rettiwt({ guestKey: 'GUEST_KEY' });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Creating a Rettiwt instance with 'user' authentication:
|
|
31
|
+
* ```
|
|
32
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
33
|
+
*
|
|
34
|
+
* // Creating a new Rettiwt instance
|
|
35
|
+
* const rettiwt = new Rettiwt({ apiKey: 'API_KEY' });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example Creating a Rettiwt instance with 'user'authentication, along with enabling debug logs and using a proxy:
|
|
39
|
+
* ```
|
|
40
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
41
|
+
*
|
|
42
|
+
* // Creating a new Rettiwt instance
|
|
43
|
+
* const rettiwt = new Rettiwt({ apiKey: 'API_KEY', loggin: true, proxyUrl: 'URL_TO_PROXY_SERVER' });
|
|
44
|
+
* ```
|
|
9
45
|
*
|
|
10
46
|
* @public
|
|
11
47
|
*/
|
package/dist/Rettiwt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rettiwt.js","sourceRoot":"","sources":["../src/Rettiwt.ts"],"names":[],"mappings":";;;AAAA,WAAW;AACX,+DAA8D;AAC9D,6DAA4D;AAK5D
|
|
1
|
+
{"version":3,"file":"Rettiwt.js","sourceRoot":"","sources":["../src/Rettiwt.ts"],"names":[],"mappings":";;;AAAA,WAAW;AACX,+DAA8D;AAC9D,6DAA4D;AAK5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH;IAOC;;;;OAIG;IACH,iBAAmB,MAAsB;QACxC,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,AAhBD,IAgBC;AAhBY,0BAAO"}
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
var _a;
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
// PACKAGES
|
|
9
|
+
var commander_1 = require("commander");
|
|
10
|
+
var Rettiwt_1 = require("./Rettiwt");
|
|
11
|
+
// SUB-COMMANDS
|
|
12
|
+
var Tweet_1 = __importDefault(require("./commands/Tweet"));
|
|
13
|
+
var User_1 = __importDefault(require("./commands/User"));
|
|
14
|
+
var Auth_1 = __importDefault(require("./commands/Auth"));
|
|
15
|
+
// Creating a new commandline program
|
|
16
|
+
var program = (0, commander_1.createCommand)('rettiwt')
|
|
17
|
+
.description('A CLI tool for accessing the Twitter API for free!')
|
|
18
|
+
.passThroughOptions()
|
|
19
|
+
.enablePositionalOptions();
|
|
20
|
+
// Adding options
|
|
21
|
+
program
|
|
22
|
+
.option('-k, --key <string>', 'The API key to use for authentication')
|
|
23
|
+
.option('-l, --log', 'Enable logging to console')
|
|
24
|
+
.option('-p, --proxy <string>', 'The URL to the proxy to use');
|
|
25
|
+
// Parsing the program to get supplied options
|
|
26
|
+
program.parse();
|
|
27
|
+
// Initializing Rettiwt instance using the given options
|
|
28
|
+
var rettiwt = new Rettiwt_1.Rettiwt({
|
|
29
|
+
apiKey: (_a = process.env.API_KEY) !== null && _a !== void 0 ? _a : program.opts().key,
|
|
30
|
+
logging: program.opts().log ? true : false,
|
|
31
|
+
proxyUrl: program.opts().proxy,
|
|
32
|
+
});
|
|
33
|
+
// Adding sub-commands
|
|
34
|
+
program.addCommand((0, Tweet_1.default)(rettiwt));
|
|
35
|
+
program.addCommand((0, User_1.default)(rettiwt));
|
|
36
|
+
program.addCommand((0, Auth_1.default)());
|
|
37
|
+
// Finalizing the CLI
|
|
38
|
+
program.parse();
|
|
39
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;AAEA,WAAW;AACX,uCAA0C;AAC1C,qCAAoC;AAEpC,eAAe;AACf,2DAAqC;AACrC,yDAAmC;AACnC,yDAAmC;AAEnC,qCAAqC;AACrC,IAAM,OAAO,GAAG,IAAA,yBAAa,EAAC,SAAS,CAAC;KACtC,WAAW,CAAC,oDAAoD,CAAC;KACjE,kBAAkB,EAAE;KACpB,uBAAuB,EAAE,CAAC;AAE5B,iBAAiB;AACjB,OAAO;KACL,MAAM,CAAC,oBAAoB,EAAE,uCAAuC,CAAC;KACrE,MAAM,CAAC,WAAW,EAAE,2BAA2B,CAAC;KAChD,MAAM,CAAC,sBAAsB,EAAE,6BAA6B,CAAC,CAAC;AAEhE,8CAA8C;AAC9C,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,wDAAwD;AACxD,IAAM,OAAO,GAAY,IAAI,iBAAO,CAAC;IACpC,MAAM,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAK,OAAO,CAAC,IAAI,EAAE,CAAC,GAAc;IAC7D,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;IAC1C,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,KAAY;CACrC,CAAC,CAAC;AAEH,sBAAsB;AACtB,OAAO,CAAC,UAAU,CAAC,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,IAAA,cAAI,EAAC,OAAO,CAAC,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,IAAA,cAAI,GAAE,CAAC,CAAC;AAE3B,qBAAqB;AACrB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
// PACKAGES
|
|
40
|
+
var commander_1 = require("commander");
|
|
41
|
+
var rettiwt_auth_1 = require("rettiwt-auth");
|
|
42
|
+
// UTILITY
|
|
43
|
+
var CliUtils_1 = require("../helper/CliUtils");
|
|
44
|
+
function createAuthCommand() {
|
|
45
|
+
var _this = this;
|
|
46
|
+
// Creating the 'auth' command
|
|
47
|
+
var auth = (0, commander_1.createCommand)('auth').description('Manage authentication');
|
|
48
|
+
// Login
|
|
49
|
+
auth.command('login')
|
|
50
|
+
.description('Generate a new API key using Twitter account login credentials')
|
|
51
|
+
.argument('<email>', 'The email id of the Twitter account')
|
|
52
|
+
.argument('<username>', 'The username associated with the Twitter account')
|
|
53
|
+
.argument('<password>', 'The password to the Twitter account')
|
|
54
|
+
.action(function (email, username, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
55
|
+
var apiKey;
|
|
56
|
+
var _a;
|
|
57
|
+
return __generator(this, function (_b) {
|
|
58
|
+
switch (_b.label) {
|
|
59
|
+
case 0: return [4 /*yield*/, new rettiwt_auth_1.Auth().getUserCredential({ email: email, userName: username, password: password })];
|
|
60
|
+
case 1:
|
|
61
|
+
apiKey = (_a = (_b.sent()).toHeader().cookie) !== null && _a !== void 0 ? _a : '';
|
|
62
|
+
// Converting the credentials to base64 string
|
|
63
|
+
apiKey = Buffer.from(apiKey).toString('base64');
|
|
64
|
+
(0, CliUtils_1.output)(apiKey);
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}); });
|
|
69
|
+
// Guest
|
|
70
|
+
auth.command('guest')
|
|
71
|
+
.description('Generate a new guest API key')
|
|
72
|
+
.action(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
73
|
+
var guestKey;
|
|
74
|
+
var _a;
|
|
75
|
+
return __generator(this, function (_b) {
|
|
76
|
+
switch (_b.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, new rettiwt_auth_1.Auth().getGuestCredential()];
|
|
78
|
+
case 1:
|
|
79
|
+
guestKey = (_a = (_b.sent()).guestToken) !== null && _a !== void 0 ? _a : '';
|
|
80
|
+
// Converting the credentials to base64 string
|
|
81
|
+
guestKey = Buffer.from(guestKey).toString('base64');
|
|
82
|
+
(0, CliUtils_1.output)(guestKey);
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); });
|
|
87
|
+
return auth;
|
|
88
|
+
}
|
|
89
|
+
exports.default = createAuthCommand;
|
|
90
|
+
//# sourceMappingURL=Auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../src/commands/Auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,uCAAmD;AACnD,6CAAoC;AAEpC,UAAU;AACV,+CAA4C;AAE5C,SAAS,iBAAiB;IAA1B,iBAmCC;IAlCA,8BAA8B;IAC9B,IAAM,IAAI,GAAG,IAAA,yBAAa,EAAC,MAAM,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAExE,QAAQ;IACR,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;SACnB,WAAW,CAAC,gEAAgE,CAAC;SAC7E,QAAQ,CAAC,SAAS,EAAE,qCAAqC,CAAC;SAC1D,QAAQ,CAAC,YAAY,EAAE,kDAAkD,CAAC;SAC1E,QAAQ,CAAC,YAAY,EAAE,qCAAqC,CAAC;SAC7D,MAAM,CAAC,UAAO,KAAa,EAAE,QAAgB,EAAE,QAAgB;;;;;wBAI7D,qBAAM,IAAI,mBAAI,EAAE,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAA;;oBAF1F,MAAM,GACT,MAAA,CACC,SAA4F,CAC5F,CAAC,QAAQ,EAAE,CAAC,MAAM,mCAAI,EAAE;oBAE1B,8CAA8C;oBAC9C,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oBAChD,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC;;;;SACf,CAAC,CAAC;IAEJ,QAAQ;IACR,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;SACnB,WAAW,CAAC,8BAA8B,CAAC;SAC3C,MAAM,CAAC;;;;;wBAEiB,qBAAM,IAAI,mBAAI,EAAE,CAAC,kBAAkB,EAAE,EAAA;;oBAAzD,QAAQ,GAAW,MAAA,CAAC,SAAqC,CAAC,CAAC,UAAU,mCAAI,EAAE;oBAE/E,8CAA8C;oBAC9C,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oBACpD,IAAA,iBAAM,EAAC,QAAQ,CAAC,CAAC;;;;SACjB,CAAC,CAAC;IAEJ,OAAO,IAAI,CAAC;AACb,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Rettiwt } from '../Rettiwt';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new 'tweet' command which uses the given Rettiwt instance.
|
|
5
|
+
*
|
|
6
|
+
* @param rettiwt - The Rettiwt instance to use.
|
|
7
|
+
* @returns The created 'tweet' command.
|
|
8
|
+
*/
|
|
9
|
+
declare function createTweetCommand(rettiwt: Rettiwt): Command;
|
|
10
|
+
export default createTweetCommand;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
// PACKAGES
|
|
40
|
+
var commander_1 = require("commander");
|
|
41
|
+
var rettiwt_core_1 = require("rettiwt-core");
|
|
42
|
+
// UTILITY
|
|
43
|
+
var CliUtils_1 = require("../helper/CliUtils");
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new 'tweet' command which uses the given Rettiwt instance.
|
|
46
|
+
*
|
|
47
|
+
* @param rettiwt - The Rettiwt instance to use.
|
|
48
|
+
* @returns The created 'tweet' command.
|
|
49
|
+
*/
|
|
50
|
+
function createTweetCommand(rettiwt) {
|
|
51
|
+
var _this = this;
|
|
52
|
+
// Creating the 'tweet' command
|
|
53
|
+
var tweet = (0, commander_1.createCommand)('tweet').description('Access resources releated to tweets');
|
|
54
|
+
// Details
|
|
55
|
+
tweet
|
|
56
|
+
.command('details')
|
|
57
|
+
.description('Fetch the details of tweet with the given id')
|
|
58
|
+
.argument('<id>', 'The id of the tweet whose details are to be fetched')
|
|
59
|
+
.action(function (id) { return __awaiter(_this, void 0, void 0, function () {
|
|
60
|
+
var details;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.details(id)];
|
|
64
|
+
case 1:
|
|
65
|
+
details = _a.sent();
|
|
66
|
+
(0, CliUtils_1.output)(details);
|
|
67
|
+
return [2 /*return*/];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); });
|
|
71
|
+
// Search
|
|
72
|
+
tweet
|
|
73
|
+
.command('search')
|
|
74
|
+
.description('Fetch the list of tweets that match the given filter options')
|
|
75
|
+
.argument('[count]', 'The number of tweets to fetch')
|
|
76
|
+
.argument('[cursor]', 'The cursor to the batch of tweets to fetch')
|
|
77
|
+
.option('-f, --from <string>', "Matches the tweets made by list of given users, separated by ';'")
|
|
78
|
+
.option('-t, --to <string>', "Matches the tweets made to the list of given users, separated by ';'")
|
|
79
|
+
.option('-w, --words <string>', "Matches the tweets containing the given list of words, separated by ';'")
|
|
80
|
+
.option('-h, --hashtags <string>', "Matches the tweets containing the given list of hashtags, separated by ';'")
|
|
81
|
+
.option('-s, --start <string>', 'Matches the tweets made since the given date (valid date string)')
|
|
82
|
+
.option('-e, --end <string>', 'Matches the tweets made upto the given date (valid date string)')
|
|
83
|
+
.action(function (count, cursor, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
84
|
+
var tweets;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.search(new TweetSearchOptions(options).toTweetFilter(), count ? parseInt(count) : undefined, cursor)];
|
|
88
|
+
case 1:
|
|
89
|
+
tweets = _a.sent();
|
|
90
|
+
(0, CliUtils_1.output)(tweets);
|
|
91
|
+
return [2 /*return*/];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); });
|
|
95
|
+
// List
|
|
96
|
+
tweet
|
|
97
|
+
.command('list')
|
|
98
|
+
.description('Fetch the list of tweets in the tweet list with the given id')
|
|
99
|
+
.argument('<id>', 'The id of the tweet list')
|
|
100
|
+
.argument('[count]', 'The number of tweets to fetch')
|
|
101
|
+
.argument('[cursor]', 'The cursor to the batch of tweets to fetch')
|
|
102
|
+
.action(function (id, count, cursor) { return __awaiter(_this, void 0, void 0, function () {
|
|
103
|
+
var tweets;
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.list(id, count ? parseInt(count) : undefined, cursor)];
|
|
107
|
+
case 1:
|
|
108
|
+
tweets = _a.sent();
|
|
109
|
+
(0, CliUtils_1.output)(tweets);
|
|
110
|
+
return [2 /*return*/];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}); });
|
|
114
|
+
// Likes
|
|
115
|
+
tweet
|
|
116
|
+
.command('likes')
|
|
117
|
+
.description('Fetch the list of users who liked the given tweets')
|
|
118
|
+
.argument('<id>', 'The id of the tweet')
|
|
119
|
+
.argument('[count]', 'The number of likers to fetch')
|
|
120
|
+
.argument('[cursor]', 'The cursor to the batch of likers to fetch')
|
|
121
|
+
.action(function (id, count, cursor) { return __awaiter(_this, void 0, void 0, function () {
|
|
122
|
+
var tweets;
|
|
123
|
+
return __generator(this, function (_a) {
|
|
124
|
+
switch (_a.label) {
|
|
125
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.favoriters(id, count ? parseInt(count) : undefined, cursor)];
|
|
126
|
+
case 1:
|
|
127
|
+
tweets = _a.sent();
|
|
128
|
+
(0, CliUtils_1.output)(tweets);
|
|
129
|
+
return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); });
|
|
133
|
+
// Retweets
|
|
134
|
+
tweet
|
|
135
|
+
.command('retweets')
|
|
136
|
+
.description('Fetch the list of users who retweeted the given tweets')
|
|
137
|
+
.argument('<id>', 'The id of the tweet')
|
|
138
|
+
.argument('[count]', 'The number of retweeters to fetch')
|
|
139
|
+
.argument('[cursor]', 'The cursor to the batch of retweeters to fetch')
|
|
140
|
+
.action(function (id, count, cursor) { return __awaiter(_this, void 0, void 0, function () {
|
|
141
|
+
var tweets;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.retweeters(id, count ? parseInt(count) : undefined, cursor)];
|
|
145
|
+
case 1:
|
|
146
|
+
tweets = _a.sent();
|
|
147
|
+
(0, CliUtils_1.output)(tweets);
|
|
148
|
+
return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}); });
|
|
152
|
+
// Post
|
|
153
|
+
tweet
|
|
154
|
+
.command('post')
|
|
155
|
+
.description('Post a tweet (text only)')
|
|
156
|
+
.argument('<text>', 'The text to post as a tweet')
|
|
157
|
+
.action(function (text) { return __awaiter(_this, void 0, void 0, function () {
|
|
158
|
+
var result;
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
switch (_a.label) {
|
|
161
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.tweet(text)];
|
|
162
|
+
case 1:
|
|
163
|
+
result = _a.sent();
|
|
164
|
+
(0, CliUtils_1.output)(result);
|
|
165
|
+
return [2 /*return*/];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}); });
|
|
169
|
+
// Like
|
|
170
|
+
tweet
|
|
171
|
+
.command('like')
|
|
172
|
+
.description('Like a tweet')
|
|
173
|
+
.argument('<id>', 'The tweet to like')
|
|
174
|
+
.action(function (id) { return __awaiter(_this, void 0, void 0, function () {
|
|
175
|
+
var result;
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.favorite(id)];
|
|
179
|
+
case 1:
|
|
180
|
+
result = _a.sent();
|
|
181
|
+
(0, CliUtils_1.output)(result);
|
|
182
|
+
return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}); });
|
|
186
|
+
// Retweet
|
|
187
|
+
tweet
|
|
188
|
+
.command('retweet')
|
|
189
|
+
.description('Retweet a tweet')
|
|
190
|
+
.argument('<id>', 'The tweet to retweet')
|
|
191
|
+
.action(function (id) { return __awaiter(_this, void 0, void 0, function () {
|
|
192
|
+
var result;
|
|
193
|
+
return __generator(this, function (_a) {
|
|
194
|
+
switch (_a.label) {
|
|
195
|
+
case 0: return [4 /*yield*/, rettiwt.tweet.retweet(id)];
|
|
196
|
+
case 1:
|
|
197
|
+
result = _a.sent();
|
|
198
|
+
(0, CliUtils_1.output)(result);
|
|
199
|
+
return [2 /*return*/];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}); });
|
|
203
|
+
return tweet;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The search options supplied while searching for tweets.
|
|
207
|
+
*
|
|
208
|
+
* @remarks The search options are implementations of the ones offered by {@link TweetFilter}
|
|
209
|
+
*/
|
|
210
|
+
var TweetSearchOptions = /** @class */ (function () {
|
|
211
|
+
/**
|
|
212
|
+
* Initializes a new object from the given options.
|
|
213
|
+
*
|
|
214
|
+
* @param options - The search options.
|
|
215
|
+
*/
|
|
216
|
+
function TweetSearchOptions(options) {
|
|
217
|
+
this.from = options === null || options === void 0 ? void 0 : options.from;
|
|
218
|
+
this.to = options === null || options === void 0 ? void 0 : options.to;
|
|
219
|
+
this.words = options === null || options === void 0 ? void 0 : options.words;
|
|
220
|
+
this.hashtags = options === null || options === void 0 ? void 0 : options.hashtags;
|
|
221
|
+
this.start = options === null || options === void 0 ? void 0 : options.start;
|
|
222
|
+
this.end = options === null || options === void 0 ? void 0 : options.end;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Converts the filter options to a format recognizable by rettiwt-api.
|
|
226
|
+
*
|
|
227
|
+
* @returns The '{@link TweetFilter}' representation of filter options.
|
|
228
|
+
*/
|
|
229
|
+
TweetSearchOptions.prototype.toTweetFilter = function () {
|
|
230
|
+
return new rettiwt_core_1.TweetFilter({
|
|
231
|
+
fromUsers: this.from ? this.from.split(';') : undefined,
|
|
232
|
+
toUsers: this.to ? this.to.split(';') : undefined,
|
|
233
|
+
words: this.words ? this.words.split(';') : undefined,
|
|
234
|
+
hashtags: this.hashtags ? this.hashtags.split(';') : undefined,
|
|
235
|
+
startDate: this.start ? new Date(this.start) : undefined,
|
|
236
|
+
endDate: this.end ? new Date(this.end) : undefined,
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
return TweetSearchOptions;
|
|
240
|
+
}());
|
|
241
|
+
exports.default = createTweetCommand;
|
|
242
|
+
//# sourceMappingURL=Tweet.js.map
|