rettiwt-api 5.0.0-alpha.0 → 5.0.0-alpha.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 +2 -3
- package/.github/workflows/documentation.yml +1 -1
- package/.github/workflows/publish-alpha.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/.prettierignore +1 -1
- package/.tool-versions +1 -1
- package/README.md +100 -100
- package/dist/Rettiwt.d.ts +1 -1
- package/dist/Rettiwt.js +15 -8
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +8 -11
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +1 -0
- package/dist/collections/Extractors.js +38 -69
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.js +2 -1
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.d.ts +3 -3
- package/dist/collections/Requests.js +36 -35
- package/dist/collections/Requests.js.map +1 -1
- package/dist/commands/List.js +21 -78
- package/dist/commands/List.js.map +1 -1
- package/dist/commands/Tweet.js +185 -370
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +129 -306
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Authentication.d.ts +18 -0
- package/dist/enums/Authentication.js +24 -0
- package/dist/enums/Authentication.js.map +1 -0
- package/dist/enums/Data.d.ts +12 -0
- package/dist/enums/Data.js +14 -1
- package/dist/enums/Data.js.map +1 -1
- package/dist/enums/Resource.d.ts +1 -0
- package/dist/enums/Resource.js +1 -0
- package/dist/enums/Resource.js.map +1 -1
- package/dist/helper/CliUtils.js +1 -2
- package/dist/helper/CliUtils.js.map +1 -1
- package/dist/helper/JsonUtils.js +6 -11
- package/dist/helper/JsonUtils.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +4 -133
- package/dist/models/args/FetchArgs.js +12 -416
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/args/PostArgs.d.ts +16 -101
- package/dist/models/args/PostArgs.js +26 -258
- package/dist/models/args/PostArgs.js.map +1 -1
- package/dist/models/auth/AccountCredential.d.ts +13 -0
- package/dist/models/auth/AccountCredential.js +21 -0
- package/dist/models/auth/AccountCredential.js.map +1 -0
- package/dist/models/auth/AuthCookie.d.ts +19 -0
- package/dist/models/auth/AuthCookie.js +53 -0
- package/dist/models/auth/AuthCookie.js.map +1 -0
- package/dist/models/auth/AuthCredential.d.ts +28 -0
- package/dist/models/auth/AuthCredential.js +76 -0
- package/dist/models/auth/AuthCredential.js.map +1 -0
- package/dist/models/data/CursoredData.d.ts +3 -4
- package/dist/models/data/CursoredData.js +19 -19
- package/dist/models/data/CursoredData.js.map +1 -1
- package/dist/models/data/List.d.ts +2 -8
- package/dist/models/data/List.js +10 -4
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Notification.d.ts +5 -21
- package/dist/models/data/Notification.js +24 -33
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +6 -23
- package/dist/models/data/Tweet.js +93 -97
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +2 -15
- package/dist/models/data/User.js +33 -23
- package/dist/models/data/User.js.map +1 -1
- package/dist/models/errors/ApiError.js +8 -24
- package/dist/models/errors/ApiError.js.map +1 -1
- package/dist/models/errors/HttpError.js +8 -24
- package/dist/models/errors/HttpError.js.map +1 -1
- package/dist/models/errors/RettiwtError.js +5 -23
- package/dist/models/errors/RettiwtError.js.map +1 -1
- package/dist/models/errors/TimeoutError.js +5 -22
- package/dist/models/errors/TimeoutError.js.map +1 -1
- package/dist/services/{public → internal}/AuthService.d.ts +5 -34
- package/dist/services/internal/AuthService.js +109 -0
- package/dist/services/internal/AuthService.js.map +1 -0
- package/dist/services/internal/ErrorService.js +38 -40
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/LogService.d.ts +0 -6
- package/dist/services/internal/LogService.js +12 -32
- package/dist/services/internal/LogService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +5 -3
- package/dist/services/public/FetcherService.js +96 -141
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.js +31 -100
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +29 -4
- package/dist/services/public/TweetService.js +208 -386
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.js +186 -385
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/RettiwtConfig.d.ts +8 -0
- package/dist/types/args/FetchArgs.d.ts +59 -0
- package/dist/types/args/FetchArgs.js +3 -0
- package/dist/types/args/FetchArgs.js.map +1 -0
- package/dist/types/args/PostArgs.d.ts +56 -0
- package/dist/types/args/PostArgs.js +3 -0
- package/dist/types/args/PostArgs.js.map +1 -0
- package/dist/types/auth/AccountCredential.d.ts +11 -0
- package/dist/types/auth/AccountCredential.js +3 -0
- package/dist/types/auth/AccountCredential.js.map +1 -0
- package/dist/types/auth/AuthCookie.d.ts +13 -0
- package/dist/types/auth/AuthCookie.js +3 -0
- package/dist/types/auth/AuthCookie.js.map +1 -0
- package/dist/types/auth/AuthCredential.d.ts +21 -0
- package/dist/types/auth/AuthCredential.js +3 -0
- package/dist/types/auth/AuthCredential.js.map +1 -0
- package/dist/types/data/CursoredData.d.ts +25 -0
- package/dist/types/data/CursoredData.js +3 -0
- package/dist/types/data/CursoredData.js.map +1 -0
- package/dist/types/data/List.d.ts +21 -0
- package/dist/types/data/List.js +3 -0
- package/dist/types/data/List.js.map +1 -0
- package/dist/types/data/Notification.d.ts +20 -0
- package/dist/types/data/Notification.js +3 -0
- package/dist/types/data/Notification.js.map +1 -0
- package/dist/types/data/Tweet.d.ts +71 -0
- package/dist/types/data/Tweet.js +3 -0
- package/dist/types/data/Tweet.js.map +1 -0
- package/dist/types/data/User.d.ts +35 -0
- package/dist/types/data/User.js +3 -0
- package/dist/types/data/User.js.map +1 -0
- package/eslint.config.mjs +17 -0
- package/package.json +22 -19
- package/src/Rettiwt.ts +1 -1
- package/src/cli.ts +0 -2
- package/src/collections/Extractors.ts +2 -0
- package/src/collections/Groups.ts +1 -0
- package/src/collections/Requests.ts +37 -36
- package/src/enums/Authentication.ts +19 -0
- package/src/enums/Data.ts +13 -0
- package/src/enums/Resource.ts +1 -0
- package/src/helper/JsonUtils.ts +1 -1
- package/src/index.ts +1 -2
- package/src/models/args/FetchArgs.ts +4 -470
- package/src/models/args/PostArgs.ts +20 -285
- package/src/models/auth/AccountCredential.ts +19 -0
- package/src/models/auth/AuthCookie.ts +56 -0
- package/src/models/auth/AuthCredential.ts +83 -0
- package/src/models/data/CursoredData.ts +12 -9
- package/src/models/data/List.ts +3 -14
- package/src/models/data/Notification.ts +6 -28
- package/src/models/data/Tweet.ts +28 -70
- package/src/models/data/User.ts +5 -31
- package/src/services/{public → internal}/AuthService.ts +28 -55
- package/src/services/internal/LogService.ts +4 -19
- package/src/services/public/FetcherService.ts +18 -8
- package/src/services/public/TweetService.ts +44 -4
- package/src/services/public/UserService.ts +2 -2
- package/src/types/RettiwtConfig.ts +7 -0
- package/src/types/args/FetchArgs.ts +64 -0
- package/src/types/args/PostArgs.ts +62 -0
- package/src/types/auth/AccountCredential.ts +13 -0
- package/src/types/auth/AuthCookie.ts +20 -0
- package/src/types/auth/AuthCredential.ts +26 -0
- package/src/types/data/CursoredData.ts +28 -0
- package/src/types/data/List.ts +27 -0
- package/src/types/data/Notification.ts +26 -0
- package/src/types/data/Tweet.ts +96 -0
- package/src/types/data/User.ts +48 -0
- package/tsconfig.json +7 -5
- package/.eslintignore +0 -3
- package/dist/commands/Auth.d.ts +0 -10
- package/dist/commands/Auth.js +0 -101
- package/dist/commands/Auth.js.map +0 -1
- package/dist/models/errors/DataValidationError.d.ts +0 -30
- package/dist/models/errors/DataValidationError.js +0 -34
- package/dist/models/errors/DataValidationError.js.map +0 -1
- package/dist/services/public/AuthService.js +0 -205
- package/dist/services/public/AuthService.js.map +0 -1
- package/src/commands/Auth.ts +0 -46
- package/src/models/errors/DataValidationError.ts +0 -44
|
@@ -1,433 +1,29 @@
|
|
|
1
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.
|
|
28
|
-
|
|
29
|
-
var rettiwt_core_1 = require("rettiwt-core");
|
|
30
|
-
var Resource_1 = require("../../enums/Resource");
|
|
31
|
-
var DataValidationError_1 = require("../errors/DataValidationError");
|
|
3
|
+
exports.FetchArgs = void 0;
|
|
4
|
+
const rettiwt_core_1 = require("rettiwt-core");
|
|
32
5
|
/**
|
|
33
6
|
* Options specifying the data that is to be fetched.
|
|
34
7
|
*
|
|
35
8
|
* @public
|
|
36
9
|
*/
|
|
37
|
-
|
|
10
|
+
class FetchArgs {
|
|
11
|
+
count;
|
|
12
|
+
cursor;
|
|
13
|
+
filter;
|
|
14
|
+
id;
|
|
15
|
+
results;
|
|
38
16
|
/**
|
|
39
17
|
* @param resource - The resource to be fetched.
|
|
40
18
|
* @param args - Additional user-defined arguments for fetching the resource.
|
|
41
19
|
*/
|
|
42
|
-
|
|
20
|
+
constructor(resource, args) {
|
|
43
21
|
this.id = args.id;
|
|
44
22
|
this.count = args.count;
|
|
45
23
|
this.cursor = args.cursor;
|
|
46
|
-
this.filter = args.filter ? new TweetFilter(args.filter) : undefined;
|
|
24
|
+
this.filter = args.filter ? new rettiwt_core_1.TweetFilter(args.filter) : undefined;
|
|
47
25
|
this.results = args.results;
|
|
48
|
-
// Validating this object
|
|
49
|
-
var validationResult = (0, class_validator_1.validateSync)(this, { groups: [resource] });
|
|
50
|
-
// If valiation error occured
|
|
51
|
-
if (validationResult.length) {
|
|
52
|
-
throw new DataValidationError_1.DataValidationError(validationResult);
|
|
53
|
-
}
|
|
54
26
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
groups: [
|
|
58
|
-
Resource_1.EResourceType.TWEET_DETAILS,
|
|
59
|
-
Resource_1.EResourceType.TWEET_DETAILS_ALT,
|
|
60
|
-
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
61
|
-
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
62
|
-
Resource_1.EResourceType.USER_FEED_FOLLOWED,
|
|
63
|
-
Resource_1.EResourceType.USER_FEED_RECOMMENDED,
|
|
64
|
-
],
|
|
65
|
-
}),
|
|
66
|
-
(0, class_validator_1.IsOptional)({
|
|
67
|
-
groups: [
|
|
68
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
69
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
70
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
71
|
-
Resource_1.EResourceType.TWEET_SEARCH,
|
|
72
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
73
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
74
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
75
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
76
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
77
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
78
|
-
Resource_1.EResourceType.USER_NOTIFICATIONS,
|
|
79
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
80
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
81
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
82
|
-
],
|
|
83
|
-
}),
|
|
84
|
-
(0, class_validator_1.Min)(1, {
|
|
85
|
-
groups: [
|
|
86
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
87
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
88
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
89
|
-
Resource_1.EResourceType.TWEET_SEARCH,
|
|
90
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
91
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
92
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
93
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
94
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
95
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
96
|
-
Resource_1.EResourceType.USER_NOTIFICATIONS,
|
|
97
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
98
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
99
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
100
|
-
],
|
|
101
|
-
}),
|
|
102
|
-
(0, class_validator_1.Max)(100, {
|
|
103
|
-
groups: [
|
|
104
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
105
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
106
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
107
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
108
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
109
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
110
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
111
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
112
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
113
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
114
|
-
],
|
|
115
|
-
}),
|
|
116
|
-
(0, class_validator_1.Max)(40, {
|
|
117
|
-
groups: [Resource_1.EResourceType.USER_NOTIFICATIONS],
|
|
118
|
-
}),
|
|
119
|
-
(0, class_validator_1.Max)(20, {
|
|
120
|
-
groups: [Resource_1.EResourceType.TWEET_SEARCH, Resource_1.EResourceType.USER_TIMELINE, Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES],
|
|
121
|
-
}),
|
|
122
|
-
__metadata("design:type", Number)
|
|
123
|
-
], FetchArgs.prototype, "count", void 0);
|
|
124
|
-
__decorate([
|
|
125
|
-
(0, class_validator_1.IsEmpty)({
|
|
126
|
-
groups: [
|
|
127
|
-
Resource_1.EResourceType.TWEET_DETAILS,
|
|
128
|
-
Resource_1.EResourceType.TWEET_DETAILS_ALT,
|
|
129
|
-
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
130
|
-
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
131
|
-
],
|
|
132
|
-
}),
|
|
133
|
-
(0, class_validator_1.IsOptional)({
|
|
134
|
-
groups: [
|
|
135
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
136
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
137
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
138
|
-
Resource_1.EResourceType.TWEET_SEARCH,
|
|
139
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
140
|
-
Resource_1.EResourceType.USER_FEED_FOLLOWED,
|
|
141
|
-
Resource_1.EResourceType.USER_FEED_RECOMMENDED,
|
|
142
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
143
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
144
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
145
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
146
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
147
|
-
Resource_1.EResourceType.USER_NOTIFICATIONS,
|
|
148
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
149
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
150
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
151
|
-
],
|
|
152
|
-
}),
|
|
153
|
-
(0, class_validator_1.IsString)({
|
|
154
|
-
groups: [
|
|
155
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
156
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
157
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
158
|
-
Resource_1.EResourceType.TWEET_SEARCH,
|
|
159
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
160
|
-
Resource_1.EResourceType.USER_FEED_FOLLOWED,
|
|
161
|
-
Resource_1.EResourceType.USER_FEED_RECOMMENDED,
|
|
162
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
163
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
164
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
165
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
166
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
167
|
-
Resource_1.EResourceType.USER_NOTIFICATIONS,
|
|
168
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
169
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
170
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
171
|
-
],
|
|
172
|
-
}),
|
|
173
|
-
__metadata("design:type", String)
|
|
174
|
-
], FetchArgs.prototype, "cursor", void 0);
|
|
175
|
-
__decorate([
|
|
176
|
-
(0, class_validator_1.IsEmpty)({
|
|
177
|
-
groups: [
|
|
178
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
179
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
180
|
-
Resource_1.EResourceType.TWEET_DETAILS,
|
|
181
|
-
Resource_1.EResourceType.TWEET_DETAILS_ALT,
|
|
182
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
183
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
184
|
-
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
185
|
-
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
186
|
-
Resource_1.EResourceType.USER_FEED_FOLLOWED,
|
|
187
|
-
Resource_1.EResourceType.USER_FEED_RECOMMENDED,
|
|
188
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
189
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
190
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
191
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
192
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
193
|
-
Resource_1.EResourceType.USER_NOTIFICATIONS,
|
|
194
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
195
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
196
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
197
|
-
],
|
|
198
|
-
}),
|
|
199
|
-
(0, class_validator_1.IsNotEmpty)({ groups: [Resource_1.EResourceType.TWEET_SEARCH] }),
|
|
200
|
-
(0, class_validator_1.IsObject)({ groups: [Resource_1.EResourceType.TWEET_SEARCH] }),
|
|
201
|
-
__metadata("design:type", TweetFilter)
|
|
202
|
-
], FetchArgs.prototype, "filter", void 0);
|
|
203
|
-
__decorate([
|
|
204
|
-
(0, class_validator_1.IsEmpty)({
|
|
205
|
-
groups: [
|
|
206
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
207
|
-
Resource_1.EResourceType.USER_FEED_FOLLOWED,
|
|
208
|
-
Resource_1.EResourceType.USER_FEED_RECOMMENDED,
|
|
209
|
-
Resource_1.EResourceType.USER_NOTIFICATIONS,
|
|
210
|
-
],
|
|
211
|
-
}),
|
|
212
|
-
(0, class_validator_1.IsNotEmpty)({
|
|
213
|
-
groups: [
|
|
214
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
215
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
216
|
-
Resource_1.EResourceType.TWEET_DETAILS,
|
|
217
|
-
Resource_1.EResourceType.TWEET_DETAILS_ALT,
|
|
218
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
219
|
-
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
220
|
-
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
221
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
222
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
223
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
224
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
225
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
226
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
227
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
228
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
229
|
-
],
|
|
230
|
-
}),
|
|
231
|
-
(0, class_validator_1.IsString)({
|
|
232
|
-
groups: [
|
|
233
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
234
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
235
|
-
Resource_1.EResourceType.TWEET_DETAILS,
|
|
236
|
-
Resource_1.EResourceType.TWEET_DETAILS_ALT,
|
|
237
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
238
|
-
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
239
|
-
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
240
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
241
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
242
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
243
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
244
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
245
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
246
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
247
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
248
|
-
],
|
|
249
|
-
}),
|
|
250
|
-
(0, class_validator_1.IsNumberString)(undefined, {
|
|
251
|
-
groups: [
|
|
252
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
253
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
254
|
-
Resource_1.EResourceType.TWEET_DETAILS,
|
|
255
|
-
Resource_1.EResourceType.TWEET_DETAILS_ALT,
|
|
256
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
257
|
-
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
258
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
259
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
260
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
261
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
262
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
263
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
264
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
265
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
266
|
-
],
|
|
267
|
-
}),
|
|
268
|
-
__metadata("design:type", String)
|
|
269
|
-
], FetchArgs.prototype, "id", void 0);
|
|
270
|
-
__decorate([
|
|
271
|
-
(0, class_validator_1.IsEmpty)({
|
|
272
|
-
groups: [
|
|
273
|
-
Resource_1.EResourceType.LIST_MEMBERS,
|
|
274
|
-
Resource_1.EResourceType.LIST_TWEETS,
|
|
275
|
-
Resource_1.EResourceType.TWEET_DETAILS,
|
|
276
|
-
Resource_1.EResourceType.TWEET_DETAILS_ALT,
|
|
277
|
-
Resource_1.EResourceType.TWEET_RETWEETERS,
|
|
278
|
-
Resource_1.EResourceType.USER_BOOKMARKS,
|
|
279
|
-
Resource_1.EResourceType.USER_DETAILS_BY_USERNAME,
|
|
280
|
-
Resource_1.EResourceType.USER_DETAILS_BY_ID,
|
|
281
|
-
Resource_1.EResourceType.USER_FEED_FOLLOWED,
|
|
282
|
-
Resource_1.EResourceType.USER_FEED_RECOMMENDED,
|
|
283
|
-
Resource_1.EResourceType.USER_FOLLOWING,
|
|
284
|
-
Resource_1.EResourceType.USER_FOLLOWERS,
|
|
285
|
-
Resource_1.EResourceType.USER_HIGHLIGHTS,
|
|
286
|
-
Resource_1.EResourceType.USER_LIKES,
|
|
287
|
-
Resource_1.EResourceType.USER_MEDIA,
|
|
288
|
-
Resource_1.EResourceType.USER_NOTIFICATIONS,
|
|
289
|
-
Resource_1.EResourceType.USER_SUBSCRIPTIONS,
|
|
290
|
-
Resource_1.EResourceType.USER_TIMELINE,
|
|
291
|
-
Resource_1.EResourceType.USER_TIMELINE_AND_REPLIES,
|
|
292
|
-
],
|
|
293
|
-
}),
|
|
294
|
-
(0, class_validator_1.IsOptional)({ groups: [Resource_1.EResourceType.TWEET_SEARCH] }),
|
|
295
|
-
__metadata("design:type", String)
|
|
296
|
-
], FetchArgs.prototype, "results", void 0);
|
|
297
|
-
return FetchArgs;
|
|
298
|
-
}());
|
|
299
|
-
/**
|
|
300
|
-
* The filter to be used for searching tweets.
|
|
301
|
-
*
|
|
302
|
-
* @public
|
|
303
|
-
*/
|
|
304
|
-
var TweetFilter = exports.TweetFilter = /** @class */ (function (_super) {
|
|
305
|
-
__extends(TweetFilter, _super);
|
|
306
|
-
/**
|
|
307
|
-
* @param filter - The filter to use for searching tweets.
|
|
308
|
-
*/
|
|
309
|
-
function TweetFilter(filter) {
|
|
310
|
-
var _this = _super.call(this, filter) || this;
|
|
311
|
-
// Validating this object
|
|
312
|
-
var validationResult = (0, class_validator_1.validateSync)(_this);
|
|
313
|
-
// If valiation error occured
|
|
314
|
-
if (validationResult.length) {
|
|
315
|
-
throw new DataValidationError_1.DataValidationError(validationResult);
|
|
316
|
-
}
|
|
317
|
-
return _this;
|
|
318
|
-
}
|
|
319
|
-
__decorate([
|
|
320
|
-
(0, class_validator_1.IsOptional)(),
|
|
321
|
-
(0, class_validator_1.IsDate)(),
|
|
322
|
-
__metadata("design:type", Date)
|
|
323
|
-
], TweetFilter.prototype, "endDate", void 0);
|
|
324
|
-
__decorate([
|
|
325
|
-
(0, class_validator_1.IsOptional)(),
|
|
326
|
-
(0, class_validator_1.IsArray)(),
|
|
327
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
328
|
-
__metadata("design:type", Array)
|
|
329
|
-
], TweetFilter.prototype, "excludeWords", void 0);
|
|
330
|
-
__decorate([
|
|
331
|
-
(0, class_validator_1.IsOptional)(),
|
|
332
|
-
(0, class_validator_1.IsArray)(),
|
|
333
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
334
|
-
__metadata("design:type", Array)
|
|
335
|
-
], TweetFilter.prototype, "fromUsers", void 0);
|
|
336
|
-
__decorate([
|
|
337
|
-
(0, class_validator_1.IsOptional)(),
|
|
338
|
-
(0, class_validator_1.IsArray)(),
|
|
339
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
340
|
-
__metadata("design:type", Array)
|
|
341
|
-
], TweetFilter.prototype, "hashtags", void 0);
|
|
342
|
-
__decorate([
|
|
343
|
-
(0, class_validator_1.IsOptional)(),
|
|
344
|
-
(0, class_validator_1.IsString)(),
|
|
345
|
-
__metadata("design:type", String)
|
|
346
|
-
], TweetFilter.prototype, "includePhrase", void 0);
|
|
347
|
-
__decorate([
|
|
348
|
-
(0, class_validator_1.IsOptional)(),
|
|
349
|
-
(0, class_validator_1.IsArray)(),
|
|
350
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
351
|
-
__metadata("design:type", Array)
|
|
352
|
-
], TweetFilter.prototype, "includeWords", void 0);
|
|
353
|
-
__decorate([
|
|
354
|
-
(0, class_validator_1.IsOptional)(),
|
|
355
|
-
(0, class_validator_1.IsString)(),
|
|
356
|
-
__metadata("design:type", String)
|
|
357
|
-
], TweetFilter.prototype, "language", void 0);
|
|
358
|
-
__decorate([
|
|
359
|
-
(0, class_validator_1.IsOptional)(),
|
|
360
|
-
(0, class_validator_1.IsBoolean)(),
|
|
361
|
-
__metadata("design:type", Boolean)
|
|
362
|
-
], TweetFilter.prototype, "links", void 0);
|
|
363
|
-
__decorate([
|
|
364
|
-
(0, class_validator_1.IsOptional)(),
|
|
365
|
-
(0, class_validator_1.IsNumberString)(),
|
|
366
|
-
__metadata("design:type", String)
|
|
367
|
-
], TweetFilter.prototype, "list", void 0);
|
|
368
|
-
__decorate([
|
|
369
|
-
(0, class_validator_1.IsOptional)(),
|
|
370
|
-
(0, class_validator_1.IsNumberString)(),
|
|
371
|
-
__metadata("design:type", String)
|
|
372
|
-
], TweetFilter.prototype, "maxId", void 0);
|
|
373
|
-
__decorate([
|
|
374
|
-
(0, class_validator_1.IsOptional)(),
|
|
375
|
-
(0, class_validator_1.IsArray)(),
|
|
376
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
377
|
-
__metadata("design:type", Array)
|
|
378
|
-
], TweetFilter.prototype, "mentions", void 0);
|
|
379
|
-
__decorate([
|
|
380
|
-
(0, class_validator_1.IsOptional)(),
|
|
381
|
-
(0, class_validator_1.IsNumber)(),
|
|
382
|
-
__metadata("design:type", Number)
|
|
383
|
-
], TweetFilter.prototype, "minLikes", void 0);
|
|
384
|
-
__decorate([
|
|
385
|
-
(0, class_validator_1.IsOptional)(),
|
|
386
|
-
(0, class_validator_1.IsNumber)(),
|
|
387
|
-
__metadata("design:type", Number)
|
|
388
|
-
], TweetFilter.prototype, "minReplies", void 0);
|
|
389
|
-
__decorate([
|
|
390
|
-
(0, class_validator_1.IsOptional)(),
|
|
391
|
-
(0, class_validator_1.IsNumber)(),
|
|
392
|
-
__metadata("design:type", Number)
|
|
393
|
-
], TweetFilter.prototype, "minRetweets", void 0);
|
|
394
|
-
__decorate([
|
|
395
|
-
(0, class_validator_1.IsOptional)(),
|
|
396
|
-
(0, class_validator_1.IsArray)(),
|
|
397
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
398
|
-
__metadata("design:type", Array)
|
|
399
|
-
], TweetFilter.prototype, "optionalWords", void 0);
|
|
400
|
-
__decorate([
|
|
401
|
-
(0, class_validator_1.IsOptional)(),
|
|
402
|
-
(0, class_validator_1.IsNumberString)(),
|
|
403
|
-
__metadata("design:type", String)
|
|
404
|
-
], TweetFilter.prototype, "quoted", void 0);
|
|
405
|
-
__decorate([
|
|
406
|
-
(0, class_validator_1.IsOptional)(),
|
|
407
|
-
(0, class_validator_1.IsBoolean)(),
|
|
408
|
-
__metadata("design:type", Boolean)
|
|
409
|
-
], TweetFilter.prototype, "replies", void 0);
|
|
410
|
-
__decorate([
|
|
411
|
-
(0, class_validator_1.IsOptional)(),
|
|
412
|
-
(0, class_validator_1.IsNumberString)(),
|
|
413
|
-
__metadata("design:type", String)
|
|
414
|
-
], TweetFilter.prototype, "sinceId", void 0);
|
|
415
|
-
__decorate([
|
|
416
|
-
(0, class_validator_1.IsOptional)(),
|
|
417
|
-
(0, class_validator_1.IsDate)(),
|
|
418
|
-
__metadata("design:type", Date)
|
|
419
|
-
], TweetFilter.prototype, "startDate", void 0);
|
|
420
|
-
__decorate([
|
|
421
|
-
(0, class_validator_1.IsOptional)(),
|
|
422
|
-
(0, class_validator_1.IsArray)(),
|
|
423
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
424
|
-
__metadata("design:type", Array)
|
|
425
|
-
], TweetFilter.prototype, "toUsers", void 0);
|
|
426
|
-
__decorate([
|
|
427
|
-
(0, class_validator_1.IsOptional)(),
|
|
428
|
-
(0, class_validator_1.IsBoolean)(),
|
|
429
|
-
__metadata("design:type", Boolean)
|
|
430
|
-
], TweetFilter.prototype, "top", void 0);
|
|
431
|
-
return TweetFilter;
|
|
432
|
-
}(rettiwt_core_1.TweetFilter));
|
|
27
|
+
}
|
|
28
|
+
exports.FetchArgs = FetchArgs;
|
|
433
29
|
//# sourceMappingURL=FetchArgs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchArgs.js","sourceRoot":"","sources":["../../../src/models/args/FetchArgs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FetchArgs.js","sourceRoot":"","sources":["../../../src/models/args/FetchArgs.ts"],"names":[],"mappings":";;;AAAA,+CAA8D;AAK9D;;;;GAIG;AACH,MAAa,SAAS;IACd,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,MAAM,CAAe;IACrB,EAAE,CAAU;IACZ,OAAO,CAAqB;IAEnC;;;OAGG;IACH,YAAmB,QAAuB,EAAE,IAAgB;QAC3D,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,0BAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,CAAC;CACD;AAlBD,8BAkBC"}
|
|
@@ -1,118 +1,33 @@
|
|
|
1
|
-
import { NewTweet
|
|
1
|
+
import { NewTweet } from 'rettiwt-core';
|
|
2
2
|
import { EResourceType } from '../../enums/Resource';
|
|
3
|
+
import { IPostArgs, IUploadArgs } from '../../types/args/PostArgs';
|
|
3
4
|
/**
|
|
4
|
-
* Options specifying the
|
|
5
|
+
* Options specifying the media file to be uploaded.
|
|
5
6
|
*
|
|
6
7
|
* @public
|
|
7
8
|
*/
|
|
8
|
-
export declare class
|
|
9
|
-
/**
|
|
10
|
-
* The id of the target resource.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Required only when posting using the following resources:
|
|
14
|
-
* - {@link EResourceType.TWEET_LIKE}
|
|
15
|
-
* - {@link EResourceType.TWEET_RETWEET}
|
|
16
|
-
* - {@link EResourceType.TWEET_UNLIKE}
|
|
17
|
-
* - {@link EResourceType.TWEET_UNPOST}
|
|
18
|
-
* - {@link EResourceType.TWEET_UNRETWEET}
|
|
19
|
-
* - {@link EResourceType.USER_FOLLOW}
|
|
20
|
-
* - {@link EResourceType.USER_UNFOLLOW}
|
|
21
|
-
*/
|
|
9
|
+
export declare class UploadArgs implements IUploadArgs {
|
|
22
10
|
id?: string;
|
|
11
|
+
media?: string | ArrayBuffer;
|
|
12
|
+
size?: number;
|
|
23
13
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* Required only when posting a tweet using {@link EResourceType.TWEET_POST}
|
|
28
|
-
*/
|
|
29
|
-
tweet?: TweetArgs;
|
|
30
|
-
/**
|
|
31
|
-
* The media file to be uploaded.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* Required only when uploading a media using the following resources:
|
|
35
|
-
* - {@link EResourceType.MEDIA_UPLOAD_APPEND}
|
|
36
|
-
* - {@link EResourceType.MEDIA_UPLOAD_FINALIZE}
|
|
37
|
-
* - {@link EResourceType.MEDIA_UPLOAD_INITIALIZE}
|
|
38
|
-
*/
|
|
39
|
-
upload?: UploadArgs;
|
|
40
|
-
/**
|
|
41
|
-
* @param resource - The resource to be posted.
|
|
42
|
-
* @param args - Additional user-defined arguments for posting the resource.
|
|
43
|
-
*/
|
|
44
|
-
constructor(resource: EResourceType, args: PostArgs);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Options specifying the tweet that is to be posted.
|
|
48
|
-
*
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
export declare class TweetArgs extends NewTweet {
|
|
52
|
-
/**
|
|
53
|
-
* The list of media to be uploaded.
|
|
54
|
-
*
|
|
55
|
-
* @remarks
|
|
56
|
-
* Maximum number of media items that can be posted is 4.
|
|
57
|
-
*/
|
|
58
|
-
media?: TweetMediaArgs[];
|
|
59
|
-
/** The id of the tweet to quote. */
|
|
60
|
-
quote?: string;
|
|
61
|
-
/** The id of the tweet to which the given tweet must be a reply. */
|
|
62
|
-
replyTo?: string;
|
|
63
|
-
/** The date/time at which the tweet must be scheduled to be posted. */
|
|
64
|
-
scheduleFor?: Date;
|
|
65
|
-
/**
|
|
66
|
-
* The text for the tweet to be created.
|
|
67
|
-
*
|
|
68
|
-
* @remarks
|
|
69
|
-
* Length of the tweet must be \<= 280 characters.
|
|
70
|
-
*/
|
|
71
|
-
text: string;
|
|
72
|
-
/**
|
|
73
|
-
* @param args - Arguments specifying the tweet to be posted.
|
|
14
|
+
* @param step - The upload step.
|
|
15
|
+
* @param args - The upload arguments for uploading the media file.
|
|
74
16
|
*/
|
|
75
|
-
constructor(
|
|
17
|
+
constructor(step: EResourceType, args: IUploadArgs);
|
|
76
18
|
}
|
|
77
19
|
/**
|
|
78
|
-
* Options specifying the
|
|
20
|
+
* Options specifying the data that is to be posted.
|
|
79
21
|
*
|
|
80
22
|
* @public
|
|
81
23
|
*/
|
|
82
|
-
export declare class
|
|
83
|
-
/** The id of the media to post. */
|
|
84
|
-
id: string;
|
|
85
|
-
/**
|
|
86
|
-
* The list of id of the users tagged in the media.
|
|
87
|
-
*
|
|
88
|
-
* @remarks
|
|
89
|
-
* Maximum number of users that can be tagged is 10.
|
|
90
|
-
*/
|
|
91
|
-
tags?: string[];
|
|
92
|
-
/**
|
|
93
|
-
* @param args - Arguments specifying the media to be posted.
|
|
94
|
-
*/
|
|
95
|
-
constructor(args: TweetMediaArgs);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Options specifying the media file to be uploaded.
|
|
99
|
-
*
|
|
100
|
-
* @internal
|
|
101
|
-
*/
|
|
102
|
-
export declare class UploadArgs {
|
|
103
|
-
/** The id allocated to the media file to be uploaded. */
|
|
24
|
+
export declare class PostArgs implements IPostArgs {
|
|
104
25
|
id?: string;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The size (in bytes) of the media file to be uploaded.
|
|
109
|
-
*
|
|
110
|
-
* @remarks The size must be \<= 5242880 bytes.
|
|
111
|
-
*/
|
|
112
|
-
size?: number;
|
|
26
|
+
tweet?: NewTweet;
|
|
27
|
+
upload?: UploadArgs;
|
|
113
28
|
/**
|
|
114
|
-
* @param
|
|
115
|
-
* @param args -
|
|
29
|
+
* @param resource - The resource to be posted.
|
|
30
|
+
* @param args - Additional user-defined arguments for posting the resource.
|
|
116
31
|
*/
|
|
117
|
-
constructor(
|
|
32
|
+
constructor(resource: EResourceType, args: IPostArgs);
|
|
118
33
|
}
|