rettiwt-api 2.4.1 → 2.5.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/.eslintrc.js +5 -0
- package/.github/workflows/documentation.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/.prettierrc +1 -1
- package/README.md +118 -60
- package/dist/Rettiwt.d.ts +7 -4
- package/dist/Rettiwt.js +4 -2
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/Auth.d.ts +2 -1
- package/dist/commands/Auth.js +10 -17
- package/dist/commands/Auth.js.map +1 -1
- package/dist/commands/Tweet.js +36 -3
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/enums/{ApiErrors.js → Api.js} +1 -1
- package/dist/enums/Api.js.map +1 -0
- package/dist/enums/Http.d.ts +68 -0
- package/dist/enums/Http.js +73 -0
- package/dist/enums/Http.js.map +1 -0
- package/dist/enums/Logging.d.ts +1 -0
- package/dist/enums/Logging.js +1 -0
- package/dist/enums/Logging.js.map +1 -1
- package/dist/index.d.ts +15 -14
- package/dist/index.js +21 -17
- package/dist/index.js.map +1 -1
- package/dist/models/{public → data}/CursoredData.d.ts +5 -3
- package/dist/models/{public → data}/CursoredData.js +1 -0
- package/dist/models/data/CursoredData.js.map +1 -0
- package/dist/{types/public → models/data}/List.d.ts +8 -1
- package/dist/models/data/List.js.map +1 -0
- package/dist/models/data/Media.d.ts +14 -0
- package/dist/models/data/Media.js +19 -0
- package/dist/models/data/Media.js.map +1 -0
- package/dist/{types/public → models/data}/Tweet.d.ts +26 -8
- package/dist/models/{public → data}/Tweet.js +4 -0
- package/dist/models/data/Tweet.js.map +1 -0
- package/dist/{types/public → models/data}/User.d.ts +8 -1
- package/dist/models/data/User.js.map +1 -0
- package/dist/models/errors/ApiError.d.ts +17 -0
- package/dist/models/errors/ApiError.js +42 -0
- package/dist/models/errors/ApiError.js.map +1 -0
- package/dist/models/errors/HttpError.d.ts +17 -0
- package/dist/models/errors/HttpError.js +42 -0
- package/dist/models/errors/HttpError.js.map +1 -0
- package/dist/models/errors/RettiwtError.d.ts +8 -0
- package/dist/models/errors/RettiwtError.js +34 -0
- package/dist/models/errors/RettiwtError.js.map +1 -0
- package/dist/models/errors/TimeoutError.d.ts +14 -0
- package/dist/models/errors/TimeoutError.js +39 -0
- package/dist/models/errors/TimeoutError.js.map +1 -0
- package/dist/services/internal/ErrorService.d.ts +85 -0
- package/dist/services/internal/ErrorService.js +144 -0
- package/dist/services/internal/ErrorService.js.map +1 -0
- package/dist/services/internal/FetcherService.d.ts +22 -24
- package/dist/services/internal/FetcherService.js +79 -59
- package/dist/services/internal/FetcherService.js.map +1 -1
- package/dist/services/public/AuthService.d.ts +66 -0
- package/dist/services/public/AuthService.js +160 -0
- package/dist/services/public/AuthService.js.map +1 -0
- package/dist/services/public/TweetService.d.ts +27 -8
- package/dist/services/public/TweetService.js +40 -5
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +5 -5
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/ErrorHandler.d.ts +13 -0
- package/dist/types/{public/User.js → ErrorHandler.js} +1 -1
- package/dist/types/ErrorHandler.js.map +1 -0
- package/dist/types/RettiwtConfig.d.ts +32 -0
- package/dist/types/RettiwtConfig.js.map +1 -0
- package/dist/types/args/TweetMediaArgs.d.ts +15 -0
- package/dist/types/{public/CursoredData.js → args/TweetMediaArgs.js} +1 -1
- package/dist/types/args/TweetMediaArgs.js.map +1 -0
- package/package.json +5 -5
- package/src/Rettiwt.ts +10 -5
- package/src/cli.ts +1 -1
- package/src/commands/Auth.ts +5 -16
- package/src/commands/Tweet.ts +56 -3
- package/src/enums/Http.ts +68 -0
- package/src/enums/Logging.ts +1 -0
- package/src/index.ts +23 -18
- package/src/models/{public → data}/CursoredData.ts +6 -5
- package/src/models/{public → data}/List.ts +14 -4
- package/src/models/data/Media.ts +19 -0
- package/src/models/{public → data}/Tweet.ts +39 -5
- package/src/models/{public → data}/User.ts +28 -4
- package/src/models/errors/ApiError.ts +24 -0
- package/src/models/errors/HttpError.ts +24 -0
- package/src/models/errors/RettiwtError.ts +12 -0
- package/src/models/errors/TimeoutError.ts +18 -0
- package/src/services/internal/ErrorService.ts +158 -0
- package/src/services/internal/FetcherService.ts +94 -80
- package/src/services/public/AuthService.ts +97 -0
- package/src/services/public/TweetService.ts +45 -10
- package/src/services/public/UserService.ts +7 -5
- package/src/types/ErrorHandler.ts +13 -0
- package/src/types/RettiwtConfig.ts +40 -0
- package/src/types/args/TweetMediaArgs.ts +16 -0
- package/dist/enums/ApiErrors.js.map +0 -1
- package/dist/enums/HTTP.d.ts +0 -17
- package/dist/enums/HTTP.js +0 -22
- package/dist/enums/HTTP.js.map +0 -1
- package/dist/models/internal/RettiwtConfig.d.ts +0 -18
- package/dist/models/internal/RettiwtConfig.js +0 -24
- package/dist/models/internal/RettiwtConfig.js.map +0 -1
- package/dist/models/public/CursoredData.js.map +0 -1
- package/dist/models/public/List.d.ts +0 -22
- package/dist/models/public/List.js.map +0 -1
- package/dist/models/public/Tweet.d.ts +0 -62
- package/dist/models/public/Tweet.js.map +0 -1
- package/dist/models/public/User.d.ts +0 -29
- package/dist/models/public/User.js.map +0 -1
- package/dist/types/internal/RettiwtConfig.d.ts +0 -15
- package/dist/types/internal/RettiwtConfig.js.map +0 -1
- package/dist/types/public/CursoredData.d.ts +0 -22
- package/dist/types/public/CursoredData.js.map +0 -1
- package/dist/types/public/List.js +0 -3
- package/dist/types/public/List.js.map +0 -1
- package/dist/types/public/Tweet.js +0 -3
- package/dist/types/public/Tweet.js.map +0 -1
- package/dist/types/public/User.js.map +0 -1
- package/src/enums/HTTP.ts +0 -17
- package/src/models/internal/RettiwtConfig.ts +0 -26
- package/src/types/internal/RettiwtConfig.ts +0 -18
- package/src/types/public/CursoredData.ts +0 -24
- package/src/types/public/List.ts +0 -27
- package/src/types/public/Tweet.ts +0 -86
- package/src/types/public/User.ts +0 -48
- /package/dist/enums/{ApiErrors.d.ts → Api.d.ts} +0 -0
- /package/dist/models/{public → data}/List.js +0 -0
- /package/dist/models/{public → data}/User.js +0 -0
- /package/dist/types/{internal/RettiwtConfig.js → RettiwtConfig.js} +0 -0
- /package/src/enums/{ApiErrors.ts → Api.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../../src/services/internal/FetcherService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../../src/services/internal/FetcherService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAasB;AACtB,gDAAiE;AACjE,gDAAqC;AACrC,6CAAoD;AACpD,uDAAoD;AAEpD,WAAW;AACX,+CAA8C;AAC9C,2CAA0C;AAM1C,QAAQ;AACR,uCAA6C;AAC7C,+CAAkD;AAElD,SAAS;AACT,+DAA8D;AAC9D,iDAAgD;AAChD,+CAA8C;AAE9C,UAAU;AACV,oDAAsD;AACtD,yBAA8B;AAE9B;;;;GAIG;AACH;IAsBC;;OAEG;IACH,wBAAmB,MAAuB;;QACzC,yBAAyB;QACzB,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;YACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAClD;QACD,2BAA2B;aACtB,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,EAAE;YAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;SACrD;QACD,wBAAwB;aACnB;YACJ,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;SACtB;QACD,IAAI,CAAC,eAAe,GAAG,CAAA,MAAM,aAA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AAE,EAAE,EAAE;6BAC/C,CAAC,CAAC,oBAAoB,EAAE,CACzB,EAAA;;wBAJD,SAIC,CAAC;wBAEF,sBAAO,EAAE,EAAC;;;;KACV;IACF,qBAAC;AAAD,CAAC,AA7TD,IA6TC;AA7TY,wCAAc"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { FetcherService } from '../internal/FetcherService';
|
|
2
|
+
import { IRettiwtConfig } from '../../types/RettiwtConfig';
|
|
3
|
+
/**
|
|
4
|
+
* Handles authentication.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuthService extends FetcherService {
|
|
9
|
+
/**
|
|
10
|
+
* @param config - The config object for configuring the Rettiwt instance.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
constructor(config?: IRettiwtConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Login to twitter using account credentials.
|
|
17
|
+
*
|
|
18
|
+
* @param email - The email id associated with the Twitter account.
|
|
19
|
+
* @param userName - The username associated with the Twitter account.
|
|
20
|
+
* @param password - The password to the Twitter account.
|
|
21
|
+
* @returns The API_KEY for the Twitter account.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```
|
|
25
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
26
|
+
*
|
|
27
|
+
* // Creating a new Rettiwt instance
|
|
28
|
+
* const rettiwt = new Rettiwt();
|
|
29
|
+
*
|
|
30
|
+
* // Logging in an getting the API_KEY
|
|
31
|
+
* rettiwt.auth.login("email@domain.com", "username", "password")
|
|
32
|
+
* .then(apiKey => {
|
|
33
|
+
* // Use the API_KEY
|
|
34
|
+
* ...
|
|
35
|
+
* })
|
|
36
|
+
* .catch(err => {
|
|
37
|
+
* console.log(err);
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
login(email: string, userName: string, password: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Login to twitter as guest.
|
|
44
|
+
*
|
|
45
|
+
* @returns A new guest key.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```
|
|
49
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
50
|
+
*
|
|
51
|
+
* // Creating a new Rettiwt instance
|
|
52
|
+
* const rettiwt = new Rettiwt();
|
|
53
|
+
*
|
|
54
|
+
* // Logging in an getting a new guest key
|
|
55
|
+
* rettiwt.auth.guest()
|
|
56
|
+
* .then(guestKey => {
|
|
57
|
+
* // Use the guest key
|
|
58
|
+
* ...
|
|
59
|
+
* })
|
|
60
|
+
* .catch(err => {
|
|
61
|
+
* console.log(err);
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
guest(): Promise<string>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.AuthService = void 0;
|
|
55
|
+
// PACKAGES
|
|
56
|
+
var rettiwt_auth_1 = require("rettiwt-auth");
|
|
57
|
+
// SERVICES
|
|
58
|
+
var FetcherService_1 = require("../internal/FetcherService");
|
|
59
|
+
/**
|
|
60
|
+
* Handles authentication.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
var AuthService = /** @class */ (function (_super) {
|
|
65
|
+
__extends(AuthService, _super);
|
|
66
|
+
/**
|
|
67
|
+
* @param config - The config object for configuring the Rettiwt instance.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
function AuthService(config) {
|
|
72
|
+
return _super.call(this, config) || this;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Login to twitter using account credentials.
|
|
76
|
+
*
|
|
77
|
+
* @param email - The email id associated with the Twitter account.
|
|
78
|
+
* @param userName - The username associated with the Twitter account.
|
|
79
|
+
* @param password - The password to the Twitter account.
|
|
80
|
+
* @returns The API_KEY for the Twitter account.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```
|
|
84
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
85
|
+
*
|
|
86
|
+
* // Creating a new Rettiwt instance
|
|
87
|
+
* const rettiwt = new Rettiwt();
|
|
88
|
+
*
|
|
89
|
+
* // Logging in an getting the API_KEY
|
|
90
|
+
* rettiwt.auth.login("email@domain.com", "username", "password")
|
|
91
|
+
* .then(apiKey => {
|
|
92
|
+
* // Use the API_KEY
|
|
93
|
+
* ...
|
|
94
|
+
* })
|
|
95
|
+
* .catch(err => {
|
|
96
|
+
* console.log(err);
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
AuthService.prototype.login = function (email, userName, password) {
|
|
101
|
+
var _a;
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
var apiKey;
|
|
104
|
+
return __generator(this, function (_b) {
|
|
105
|
+
switch (_b.label) {
|
|
106
|
+
case 0: return [4 /*yield*/, new rettiwt_auth_1.Auth({ proxyUrl: this.authProxyUrl }).getUserCredential({
|
|
107
|
+
email: email,
|
|
108
|
+
userName: userName,
|
|
109
|
+
password: password,
|
|
110
|
+
})];
|
|
111
|
+
case 1:
|
|
112
|
+
apiKey = (_a = (_b.sent()).toHeader().cookie) !== null && _a !== void 0 ? _a : '';
|
|
113
|
+
// Converting the credentials to base64 string
|
|
114
|
+
apiKey = Buffer.from(apiKey).toString('base64');
|
|
115
|
+
return [2 /*return*/, apiKey];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Login to twitter as guest.
|
|
122
|
+
*
|
|
123
|
+
* @returns A new guest key.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```
|
|
127
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
128
|
+
*
|
|
129
|
+
* // Creating a new Rettiwt instance
|
|
130
|
+
* const rettiwt = new Rettiwt();
|
|
131
|
+
*
|
|
132
|
+
* // Logging in an getting a new guest key
|
|
133
|
+
* rettiwt.auth.guest()
|
|
134
|
+
* .then(guestKey => {
|
|
135
|
+
* // Use the guest key
|
|
136
|
+
* ...
|
|
137
|
+
* })
|
|
138
|
+
* .catch(err => {
|
|
139
|
+
* console.log(err);
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
AuthService.prototype.guest = function () {
|
|
144
|
+
var _a;
|
|
145
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
146
|
+
var guestKey;
|
|
147
|
+
return __generator(this, function (_b) {
|
|
148
|
+
switch (_b.label) {
|
|
149
|
+
case 0: return [4 /*yield*/, new rettiwt_auth_1.Auth().getGuestCredential()];
|
|
150
|
+
case 1:
|
|
151
|
+
guestKey = (_a = (_b.sent()).guestToken) !== null && _a !== void 0 ? _a : '';
|
|
152
|
+
return [2 /*return*/, guestKey];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
return AuthService;
|
|
158
|
+
}(FetcherService_1.FetcherService));
|
|
159
|
+
exports.AuthService = AuthService;
|
|
160
|
+
//# sourceMappingURL=AuthService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../../src/services/public/AuthService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAAoC;AAEpC,WAAW;AACX,6DAA4D;AAK5D;;;;GAIG;AACH;IAAiC,+BAAc;IAC9C;;;;OAIG;IACH,qBAAmB,MAAuB;eACzC,kBAAM,MAAM,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACU,2BAAK,GAAlB,UAAmB,KAAa,EAAE,QAAgB,EAAE,QAAgB;;;;;;4BAIjE,qBAAM,IAAI,mBAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,iBAAiB,CAAC;4BACjE,KAAK,EAAE,KAAK;4BACZ,QAAQ,EAAE,QAAQ;4BAClB,QAAQ,EAAE,QAAQ;yBAClB,CAAC,EAAA;;wBANA,MAAM,GACT,MAAC,CACA,SAIE,CACF,CAAC,QAAQ,EAAE,CAAC,MAAiB,mCAAI,EAAE;wBAErC,8CAA8C;wBAC9C,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;wBAEhD,sBAAO,MAAM,EAAC;;;;KACd;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,2BAAK,GAAlB;;;;;;4BAE2B,qBAAM,IAAI,mBAAI,EAAE,CAAC,kBAAkB,EAAE,EAAA;;wBAAzD,QAAQ,GAAW,MAAA,CAAC,SAAqC,CAAC,CAAC,UAAU,mCAAI,EAAE;wBAEjF,sBAAO,QAAQ,EAAC;;;;KAChB;IACF,kBAAC;AAAD,CAAC,AAlFD,CAAiC,+BAAc,GAkF9C;AAlFY,kCAAW"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { TweetFilter } from 'rettiwt-core';
|
|
2
2
|
import { FetcherService } from '../internal/FetcherService';
|
|
3
|
-
import {
|
|
4
|
-
import { Tweet } from '../../models/
|
|
5
|
-
import { User } from '../../models/
|
|
6
|
-
import { CursoredData } from '../../models/
|
|
3
|
+
import { IRettiwtConfig } from '../../types/RettiwtConfig';
|
|
4
|
+
import { Tweet } from '../../models/data/Tweet';
|
|
5
|
+
import { User } from '../../models/data/User';
|
|
6
|
+
import { CursoredData } from '../../models/data/CursoredData';
|
|
7
|
+
import { ITweetMediaArgs } from '../../types/args/TweetMediaArgs';
|
|
7
8
|
/**
|
|
8
9
|
* Handles fetching of data related to tweets.
|
|
9
10
|
*
|
|
@@ -15,7 +16,7 @@ export declare class TweetService extends FetcherService {
|
|
|
15
16
|
*
|
|
16
17
|
* @internal
|
|
17
18
|
*/
|
|
18
|
-
constructor(config?:
|
|
19
|
+
constructor(config?: IRettiwtConfig);
|
|
19
20
|
/**
|
|
20
21
|
* Get the details of a tweet.
|
|
21
22
|
*
|
|
@@ -159,10 +160,11 @@ export declare class TweetService extends FetcherService {
|
|
|
159
160
|
/**
|
|
160
161
|
* Post a tweet.
|
|
161
162
|
*
|
|
162
|
-
* @param
|
|
163
|
+
* @param text - The text to be posted, length must be \<= 280 characters.
|
|
164
|
+
* @param media - The list of media to post in the tweet.
|
|
163
165
|
* @returns Whether posting was successful or not.
|
|
164
166
|
*
|
|
165
|
-
* @example
|
|
167
|
+
* @example Posting a simple text
|
|
166
168
|
* ```
|
|
167
169
|
* import { Rettiwt } from 'rettiwt-api';
|
|
168
170
|
*
|
|
@@ -179,9 +181,26 @@ export declare class TweetService extends FetcherService {
|
|
|
179
181
|
* });
|
|
180
182
|
* ```
|
|
181
183
|
*
|
|
184
|
+
* @example Posting a tweet with an image
|
|
185
|
+
* ```
|
|
186
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
187
|
+
*
|
|
188
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
189
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
190
|
+
*
|
|
191
|
+
* // Posting a tweet, containing an image called 'mountains.jpg', to twitter
|
|
192
|
+
* rettiwt.tweet.tweet('What a nice view!', [{ path: 'mountains.jpg' }])
|
|
193
|
+
* .then(res => {
|
|
194
|
+
* console.log(res);
|
|
195
|
+
* })
|
|
196
|
+
* .catch(err => {
|
|
197
|
+
* console.log(err);
|
|
198
|
+
* });
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
182
201
|
* @public
|
|
183
202
|
*/
|
|
184
|
-
tweet(
|
|
203
|
+
tweet(text: string, media?: ITweetMediaArgs[]): Promise<boolean>;
|
|
185
204
|
/**
|
|
186
205
|
* Favorite the tweet with the given id.
|
|
187
206
|
*
|
|
@@ -294,10 +294,11 @@ var TweetService = /** @class */ (function (_super) {
|
|
|
294
294
|
/**
|
|
295
295
|
* Post a tweet.
|
|
296
296
|
*
|
|
297
|
-
* @param
|
|
297
|
+
* @param text - The text to be posted, length must be \<= 280 characters.
|
|
298
|
+
* @param media - The list of media to post in the tweet.
|
|
298
299
|
* @returns Whether posting was successful or not.
|
|
299
300
|
*
|
|
300
|
-
* @example
|
|
301
|
+
* @example Posting a simple text
|
|
301
302
|
* ```
|
|
302
303
|
* import { Rettiwt } from 'rettiwt-api';
|
|
303
304
|
*
|
|
@@ -314,15 +315,49 @@ var TweetService = /** @class */ (function (_super) {
|
|
|
314
315
|
* });
|
|
315
316
|
* ```
|
|
316
317
|
*
|
|
318
|
+
* @example Posting a tweet with an image
|
|
319
|
+
* ```
|
|
320
|
+
* import { Rettiwt } from 'rettiwt-api';
|
|
321
|
+
*
|
|
322
|
+
* // Creating a new Rettiwt instance using the given 'API_KEY'
|
|
323
|
+
* const rettiwt = new Rettiwt({ apiKey: API_KEY });
|
|
324
|
+
*
|
|
325
|
+
* // Posting a tweet, containing an image called 'mountains.jpg', to twitter
|
|
326
|
+
* rettiwt.tweet.tweet('What a nice view!', [{ path: 'mountains.jpg' }])
|
|
327
|
+
* .then(res => {
|
|
328
|
+
* console.log(res);
|
|
329
|
+
* })
|
|
330
|
+
* .catch(err => {
|
|
331
|
+
* console.log(err);
|
|
332
|
+
* });
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
317
335
|
* @public
|
|
318
336
|
*/
|
|
319
|
-
TweetService.prototype.tweet = function (
|
|
337
|
+
TweetService.prototype.tweet = function (text, media) {
|
|
320
338
|
return __awaiter(this, void 0, void 0, function () {
|
|
321
|
-
var data;
|
|
339
|
+
var uploadedMedia, _i, media_1, item, id, data;
|
|
322
340
|
return __generator(this, function (_a) {
|
|
323
341
|
switch (_a.label) {
|
|
324
|
-
case 0:
|
|
342
|
+
case 0:
|
|
343
|
+
uploadedMedia = [];
|
|
344
|
+
if (!media) return [3 /*break*/, 4];
|
|
345
|
+
_i = 0, media_1 = media;
|
|
346
|
+
_a.label = 1;
|
|
325
347
|
case 1:
|
|
348
|
+
if (!(_i < media_1.length)) return [3 /*break*/, 4];
|
|
349
|
+
item = media_1[_i];
|
|
350
|
+
return [4 /*yield*/, this.upload(item.path)];
|
|
351
|
+
case 2:
|
|
352
|
+
id = _a.sent();
|
|
353
|
+
// Storing the uploaded media item
|
|
354
|
+
uploadedMedia.push({ id: id, tags: item.tags });
|
|
355
|
+
_a.label = 3;
|
|
356
|
+
case 3:
|
|
357
|
+
_i++;
|
|
358
|
+
return [3 /*break*/, 1];
|
|
359
|
+
case 4: return [4 /*yield*/, this.post(rettiwt_core_1.EResourceType.CREATE_TWEET, { tweet: { text: text, media: uploadedMedia } })];
|
|
360
|
+
case 5:
|
|
326
361
|
data = _a.sent();
|
|
327
362
|
return [2 /*return*/, data];
|
|
328
363
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TweetService.js","sourceRoot":"","sources":["../../../src/services/public/TweetService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,
|
|
1
|
+
{"version":3,"file":"TweetService.js","sourceRoot":"","sources":["../../../src/services/public/TweetService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAAqE;AAErE,WAAW;AACX,6DAA4D;AAW5D;;;;GAIG;AACH;IAAkC,gCAAc;IAC/C;;;;OAIG;IACH,sBAAmB,MAAuB;eACzC,kBAAM,MAAM,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,8BAAO,GAApB,UAAqB,EAAU;;;;;4BAEjB,qBAAM,IAAI,CAAC,KAAK,CAAQ,4BAAa,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAA;;wBAAvE,IAAI,GAAG,SAAgE;wBAE7E,sBAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC;;;;KACpB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACU,6BAAM,GAAnB,UAAoB,KAAkB,EAAE,KAAc,EAAE,MAAe;;;;;4BAEzD,qBAAM,IAAI,CAAC,KAAK,CAAQ,4BAA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AI,CAAC,4BAAa,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAA;;wBAArE,IAAI,GAAG,SAA8D;wBAE3E,sBAAO,IAAI,EAAC;;;;KACZ;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,8BAAO,GAApB,UAAqB,OAAe;;;;;4BAEtB,qBAAM,IAAI,CAAC,IAAI,CAAC,4BAAa,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAA;;wBAArE,IAAI,GAAG,SAA8D;wBAE3E,sBAAO,IAAI,EAAC;;;;KACZ;IACF,mBAAC;AAAD,CAAC,AAzUD,CAAkC,+BAAc,GAyU/C;AAzUY,oCAAY"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FetcherService } from '../internal/FetcherService';
|
|
2
|
-
import {
|
|
3
|
-
import { User } from '../../models/
|
|
4
|
-
import { Tweet } from '../../models/
|
|
5
|
-
import { CursoredData } from '../../models/
|
|
2
|
+
import { IRettiwtConfig } from '../../types/RettiwtConfig';
|
|
3
|
+
import { User } from '../../models/data/User';
|
|
4
|
+
import { Tweet } from '../../models/data/Tweet';
|
|
5
|
+
import { CursoredData } from '../../models/data/CursoredData';
|
|
6
6
|
/**
|
|
7
7
|
* Handles fetching of data related to user account
|
|
8
8
|
*
|
|
@@ -14,7 +14,7 @@ export declare class UserService extends FetcherService {
|
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
|
-
constructor(config?:
|
|
17
|
+
constructor(config?: IRettiwtConfig);
|
|
18
18
|
/**
|
|
19
19
|
* Get the details of a user.
|
|
20
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAA6C;A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I,GAAG,SAIX;wBAEF,qEAAqE;wBACrE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,MAAM,EAA1B,CAA0B,CAAC,CAAC;wBAEpE,sBAAO,IAAI,EAAC;;;;KACZ;IACF,kBAAC;AAAD,CAAC,AA3QD,CAAiC,+BAAc,GA2Q9C;AA3QY,kCAAW"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the error handler that processes API/HTTP errors in the responses.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IErrorHandler {
|
|
7
|
+
/**
|
|
8
|
+
* The method called when an error response is received from Twitter API.
|
|
9
|
+
*
|
|
10
|
+
* @param error - The error caught while making request to Twitter API.
|
|
11
|
+
*/
|
|
12
|
+
handle(error: unknown): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorHandler.js","sourceRoot":"","sources":["../../src/types/ErrorHandler.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IErrorHandler } from './ErrorHandler';
|
|
2
|
+
/**
|
|
3
|
+
* The configuration for initializing a new Rettiwt instance.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface IRettiwtConfig {
|
|
8
|
+
/** The apiKey (cookie) to use for authenticating Rettiwt against Twitter API. */
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
/** The guestKey (guest token) to use for guest access to Twitter API. */
|
|
11
|
+
guestKey?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional URL to proxy server to use for requests to Twitter API.
|
|
14
|
+
*
|
|
15
|
+
* @remarks When deploying to cloud platforms, if setting {@link IRettiwtConfig.authProxyUrl} does not resolve Error 429, then this might be required.
|
|
16
|
+
*/
|
|
17
|
+
proxyUrl?: URL;
|
|
18
|
+
/**
|
|
19
|
+
* Optional URL to proxy server to use for authentication against Twitter API.
|
|
20
|
+
*
|
|
21
|
+
* @remarks Required when deploying to cloud platforms to bypass Error 429.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue Same as {@link IRettiwtConfig.proxyUrl}
|
|
24
|
+
*/
|
|
25
|
+
authProxyUrl?: URL;
|
|
26
|
+
/** The max wait time (in milli-seconds) for a response; if not set, Twitter server timeout is used. */
|
|
27
|
+
timeout?: number;
|
|
28
|
+
/** Whether to write logs to console or not. */
|
|
29
|
+
logging?: boolean;
|
|
30
|
+
/** Optional custom error handler to define error conditions and process API/HTTP errors in responses. */
|
|
31
|
+
errorHandler?: IErrorHandler;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RettiwtConfig.js","sourceRoot":"","sources":["../../src/types/RettiwtConfig.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arguments specifying the media to be posted in a single tweet.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface ITweetMediaArgs {
|
|
7
|
+
/**
|
|
8
|
+
* The path to the media file.
|
|
9
|
+
*
|
|
10
|
+
* @remarks The size of the media file must be \<= 5242880 bytes.
|
|
11
|
+
*/
|
|
12
|
+
path: string;
|
|
13
|
+
/** The list usernames of users to be tagged in the media. */
|
|
14
|
+
tags?: string[];
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TweetMediaArgs.js","sourceRoot":"","sources":["../../../src/types/args/TweetMediaArgs.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rettiwt-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"description": "An API for fetching data from TwitterAPI, without any rate limits!",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"prepare": "tsc",
|
|
13
13
|
"format": "prettier --write .",
|
|
14
14
|
"lint": "eslint --max-warnings 0 .",
|
|
15
|
-
"docs": "typedoc src/index.ts",
|
|
15
|
+
"docs": "typedoc --excludePrivate --excludeProtected --excludeInternal src/index.ts",
|
|
16
16
|
"debug": "nodemon ./dist/index.js --inspect=0.0.0.0:9229"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://rishikant181.github.io/Rettiwt-API/",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"axios": "1.3
|
|
32
|
+
"axios": "1.6.3",
|
|
33
33
|
"commander": "11.1.0",
|
|
34
34
|
"https-proxy-agent": "7.0.2",
|
|
35
|
-
"rettiwt-auth": "2.
|
|
36
|
-
"rettiwt-core": "3.
|
|
35
|
+
"rettiwt-auth": "2.1.0",
|
|
36
|
+
"rettiwt-core": "3.3.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "20.4.1",
|
package/src/Rettiwt.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// SERVICES
|
|
2
|
+
import { AuthService } from './services/public/AuthService';
|
|
2
3
|
import { TweetService } from './services/public/TweetService';
|
|
3
4
|
import { UserService } from './services/public/UserService';
|
|
4
5
|
|
|
5
|
-
//
|
|
6
|
-
import {
|
|
6
|
+
// TYPES
|
|
7
|
+
import { IRettiwtConfig } from './types/RettiwtConfig';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* The class for accessing Twitter API.
|
|
10
11
|
*
|
|
11
12
|
* The created Rettiwt instance can be configured by passing in a configuration object to the constructor.
|
|
12
13
|
*
|
|
13
|
-
* For details regarding the available configuration options, refer to {@link
|
|
14
|
+
* For details regarding the available configuration options, refer to {@link IRettiwtConfig}
|
|
14
15
|
*
|
|
15
16
|
* @example Creating a Rettiwt instance with 'guest' authentication:
|
|
16
17
|
* ```
|
|
@@ -41,12 +42,15 @@ import { RettiwtConfig } from './models/internal/RettiwtConfig';
|
|
|
41
42
|
* import { Rettiwt } from 'rettiwt-api';
|
|
42
43
|
*
|
|
43
44
|
* // Creating a new Rettiwt instance
|
|
44
|
-
* const rettiwt = new Rettiwt({ apiKey: 'API_KEY',
|
|
45
|
+
* const rettiwt = new Rettiwt({ apiKey: 'API_KEY', logging: true, proxyUrl: 'URL_TO_PROXY_SERVER' });
|
|
45
46
|
* ```
|
|
46
47
|
*
|
|
47
48
|
* @public
|
|
48
49
|
*/
|
|
49
50
|
export class Rettiwt {
|
|
51
|
+
/** The instance used to authenticate. */
|
|
52
|
+
public auth: AuthService;
|
|
53
|
+
|
|
50
54
|
/** The instance used to fetch data related to tweets. */
|
|
51
55
|
public tweet: TweetService;
|
|
52
56
|
|
|
@@ -58,7 +62,8 @@ export class Rettiwt {
|
|
|
58
62
|
*
|
|
59
63
|
* @param config - The config object for configuring the Rettiwt instance.
|
|
60
64
|
*/
|
|
61
|
-
public constructor(config?:
|
|
65
|
+
public constructor(config?: IRettiwtConfig) {
|
|
66
|
+
this.auth = new AuthService(config);
|
|
62
67
|
this.tweet = new TweetService(config);
|
|
63
68
|
this.user = new UserService(config);
|
|
64
69
|
}
|
package/src/cli.ts
CHANGED