twitter-openapi-typescript 0.0.56 → 0.1.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.
Files changed (58) hide show
  1. package/LICENSE +31 -31
  2. package/LICENSE.AGPL +660 -660
  3. package/README.md +75 -75
  4. package/dist/src/api.d.ts +3 -3
  5. package/dist/src/api.d.ts.map +1 -1
  6. package/dist/src/api.js +161 -295
  7. package/dist/src/api.js.map +1 -1
  8. package/dist/src/apis/defaultApi.d.ts +2 -2
  9. package/dist/src/apis/defaultApi.d.ts.map +1 -1
  10. package/dist/src/apis/defaultApi.js +39 -114
  11. package/dist/src/apis/defaultApi.js.map +1 -1
  12. package/dist/src/apis/initialStateApi.js +2 -5
  13. package/dist/src/apis/initialStateApi.js.map +1 -1
  14. package/dist/src/apis/postApi.d.ts +2 -2
  15. package/dist/src/apis/postApi.d.ts.map +1 -1
  16. package/dist/src/apis/postApi.js +140 -251
  17. package/dist/src/apis/postApi.js.map +1 -1
  18. package/dist/src/apis/tweetApi.d.ts +6 -3
  19. package/dist/src/apis/tweetApi.d.ts.map +1 -1
  20. package/dist/src/apis/tweetApi.js +237 -342
  21. package/dist/src/apis/tweetApi.js.map +1 -1
  22. package/dist/src/apis/userApi.d.ts +3 -3
  23. package/dist/src/apis/userApi.d.ts.map +1 -1
  24. package/dist/src/apis/userApi.js +43 -108
  25. package/dist/src/apis/userApi.js.map +1 -1
  26. package/dist/src/apis/userListApi.d.ts +3 -3
  27. package/dist/src/apis/userListApi.d.ts.map +1 -1
  28. package/dist/src/apis/userListApi.js +97 -183
  29. package/dist/src/apis/userListApi.js.map +1 -1
  30. package/dist/src/apis/usersApi.d.ts +3 -3
  31. package/dist/src/apis/usersApi.d.ts.map +1 -1
  32. package/dist/src/apis/usersApi.js +28 -91
  33. package/dist/src/apis/usersApi.js.map +1 -1
  34. package/dist/src/apis/v11GetApi.d.ts +3 -3
  35. package/dist/src/apis/v11GetApi.d.ts.map +1 -1
  36. package/dist/src/apis/v11GetApi.js +3 -4
  37. package/dist/src/apis/v11GetApi.js.map +1 -1
  38. package/dist/src/apis/v11PostApi.d.ts +3 -3
  39. package/dist/src/apis/v11PostApi.d.ts.map +1 -1
  40. package/dist/src/apis/v11PostApi.js +50 -84
  41. package/dist/src/apis/v11PostApi.js.map +1 -1
  42. package/dist/src/apis/v20GetApi.d.ts +3 -3
  43. package/dist/src/apis/v20GetApi.d.ts.map +1 -1
  44. package/dist/src/apis/v20GetApi.js +3 -4
  45. package/dist/src/apis/v20GetApi.js.map +1 -1
  46. package/dist/src/index.d.ts +4 -4
  47. package/dist/src/index.js +4 -4
  48. package/dist/src/models/response.d.ts +1 -1
  49. package/dist/src/models/response.d.ts.map +1 -1
  50. package/dist/src/models/timeline.d.ts +2 -2
  51. package/dist/src/models/timeline.d.ts.map +1 -1
  52. package/dist/src/models/utils.d.ts +2 -2
  53. package/dist/src/models/utils.d.ts.map +1 -1
  54. package/dist/src/utils/api.d.ts +2 -2
  55. package/dist/src/utils/api.d.ts.map +1 -1
  56. package/dist/src/utils/api.js +68 -85
  57. package/dist/src/utils/api.js.map +1 -1
  58. package/package.json +37 -42
@@ -1,364 +1,259 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- 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;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __read = (this && this.__read) || function (o, n) {
50
- var m = typeof Symbol === "function" && o[Symbol.iterator];
51
- if (!m) return o;
52
- var i = m.call(o), r, ar = [], e;
53
- try {
54
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
55
- }
56
- catch (error) { e = { error: error }; }
57
- finally {
58
- try {
59
- if (r && !r.done && (m = i["return"])) m.call(i);
60
- }
61
- finally { if (e) throw e.error; }
62
- }
63
- return ar;
64
- };
65
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
66
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
67
- if (ar || !(i in from)) {
68
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
69
- ar[i] = from[i];
70
- }
71
- }
72
- return to.concat(ar || Array.prototype.slice.call(from));
73
- };
74
2
  Object.defineProperty(exports, "__esModule", { value: true });
75
3
  exports.TweetApiUtils = void 0;
76
- var utils_1 = require("../utils");
77
- var TweetApiUtils = /** @class */ (function () {
78
- function TweetApiUtils(api, flag, initOverrides) {
4
+ const utils_1 = require("../utils/index.js");
5
+ class TweetApiUtils {
6
+ constructor(api, flag, initOverrides) {
79
7
  this.api = api;
80
8
  this.flag = flag;
81
9
  this.initOverrides = initOverrides;
82
10
  }
83
- TweetApiUtils.prototype.request = function (param) {
84
- return __awaiter(this, void 0, void 0, function () {
85
- var apiFn, args, response, instruction, _a, _b, entry, data;
86
- return __generator(this, function (_c) {
87
- switch (_c.label) {
88
- case 0:
89
- apiFn = param.apiFn.bind(this.api);
90
- args = (0, utils_1.getKwargs)(this.flag[param.key], param.param);
91
- return [4 /*yield*/, apiFn(args, this.initOverrides(this.flag[param.key]))];
92
- case 1:
93
- response = _c.sent();
94
- _b = (_a = param).convertFn;
95
- return [4 /*yield*/, response.value()];
96
- case 2:
97
- instruction = _b.apply(_a, [_c.sent()]);
98
- entry = (0, utils_1.instructionToEntry)(instruction);
99
- data = __spreadArray(__spreadArray([], __read((0, utils_1.tweetEntriesConverter)(entry)), false), __read((0, utils_1.instructionConverter)(instruction)), false);
100
- return [2 /*return*/, {
101
- raw: {
102
- response: response.raw,
103
- },
104
- header: (0, utils_1.buildHeader)(response.raw.headers),
105
- data: {
106
- raw: {
107
- instruction: instruction,
108
- entry: entry,
109
- },
110
- cursor: (0, utils_1.entriesCursor)(entry),
111
- data: data,
112
- },
113
- }];
114
- }
115
- });
11
+ async request(param) {
12
+ const apiFn = param.apiFn.bind(this.api);
13
+ const args = (0, utils_1.getKwargs)(this.flag[param.key], param.param);
14
+ const response = await apiFn(args, this.initOverrides(this.flag[param.key]));
15
+ const instruction = param.convertFn(await response.value());
16
+ const entry = (0, utils_1.instructionToEntry)(instruction);
17
+ const data = [...(0, utils_1.tweetEntriesConverter)(entry), ...(0, utils_1.instructionConverter)(instruction)];
18
+ return {
19
+ raw: {
20
+ response: response.raw,
21
+ },
22
+ header: (0, utils_1.buildHeader)(response.raw.headers),
23
+ data: {
24
+ raw: {
25
+ instruction,
26
+ entry,
27
+ },
28
+ cursor: (0, utils_1.entriesCursor)(entry),
29
+ data: data,
30
+ },
31
+ };
32
+ }
33
+ async getTweetDetail(param) {
34
+ const args = {
35
+ focalTweetId: param.focalTweetId,
36
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
37
+ ...(param.controllerData == undefined ? {} : { controller_data: param.controllerData }),
38
+ ...param.extraParam,
39
+ };
40
+ const response = await this.request({
41
+ apiFn: this.api.getTweetDetailRaw,
42
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.threadedConversationWithInjectionsV2, e.errors).instructions,
43
+ key: 'TweetDetail',
44
+ param: args,
116
45
  });
117
- };
118
- TweetApiUtils.prototype.getTweetDetail = function (param) {
119
- return __awaiter(this, void 0, void 0, function () {
120
- var args, response;
121
- return __generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0:
124
- args = __assign(__assign(__assign({ focalTweetId: param.focalTweetId }, (param.cursor == undefined ? {} : { cursor: param.cursor })), (param.controllerData == undefined ? {} : { controller_data: param.controllerData })), param.extraParam);
125
- return [4 /*yield*/, this.request({
126
- apiFn: this.api.getTweetDetailRaw,
127
- convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.threadedConversationWithInjectionsV2, e.errors).instructions; },
128
- key: 'TweetDetail',
129
- param: args,
130
- })];
131
- case 1:
132
- response = _a.sent();
133
- return [2 /*return*/, response];
134
- }
135
- });
46
+ return response;
47
+ }
48
+ async getSearchTimeline(param) {
49
+ const args = {
50
+ rawQuery: param.rawQuery,
51
+ ...(param.product == undefined ? {} : { product: param.product }),
52
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
53
+ ...(param.count == undefined ? {} : { count: param.count }),
54
+ ...param.extraParam,
55
+ };
56
+ const response = await this.request({
57
+ apiFn: this.api.getSearchTimelineRaw,
58
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.searchByRawQuery, e.errors).searchTimeline.timeline.instructions,
59
+ key: 'SearchTimeline',
60
+ param: args,
136
61
  });
137
- };
138
- TweetApiUtils.prototype.getSearchTimeline = function (param) {
139
- return __awaiter(this, void 0, void 0, function () {
140
- var args, response;
141
- return __generator(this, function (_a) {
142
- switch (_a.label) {
143
- case 0:
144
- args = __assign(__assign(__assign(__assign({ rawQuery: param.rawQuery }, (param.product == undefined ? {} : { product: param.product })), (param.cursor == undefined ? {} : { cursor: param.cursor })), (param.count == undefined ? {} : { count: param.count })), param.extraParam);
145
- return [4 /*yield*/, this.request({
146
- apiFn: this.api.getSearchTimelineRaw,
147
- convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.searchByRawQuery, e.errors).searchTimeline.timeline.instructions; },
148
- key: 'SearchTimeline',
149
- param: args,
150
- })];
151
- case 1:
152
- response = _a.sent();
153
- return [2 /*return*/, response];
154
- }
155
- });
62
+ return response;
63
+ }
64
+ async getHomeTimeline(param = {}) {
65
+ const args = {
66
+ ...(param.count == undefined ? {} : { count: param.count }),
67
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
68
+ ...param.extraParam,
69
+ };
70
+ const response = await this.request({
71
+ apiFn: this.api.getHomeTimelineRaw,
72
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.home, e.errors).homeTimelineUrt.instructions,
73
+ key: 'HomeTimeline',
74
+ param: args,
75
+ });
76
+ return response;
77
+ }
78
+ async getHomeLatestTimeline(param = {}) {
79
+ const args = {
80
+ ...(param.count == undefined ? {} : { count: param.count }),
81
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
82
+ ...param.extraParam,
83
+ };
84
+ const response = await this.request({
85
+ apiFn: this.api.getHomeLatestTimelineRaw,
86
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.home, e.errors).homeTimelineUrt.instructions,
87
+ key: 'HomeLatestTimeline',
88
+ param: args,
89
+ });
90
+ return response;
91
+ }
92
+ async getListLatestTweetsTimeline(param) {
93
+ const args = {
94
+ listId: param.listId,
95
+ ...(param.count == undefined ? {} : { count: param.count }),
96
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
97
+ ...param.extraParam,
98
+ };
99
+ const response = await this.request({
100
+ apiFn: this.api.getListLatestTweetsTimelineRaw,
101
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.list?.tweetsTimeline.timeline, e.errors).instructions,
102
+ key: 'ListLatestTweetsTimeline',
103
+ param: args,
156
104
  });
157
- };
158
- TweetApiUtils.prototype.getHomeTimeline = function () {
159
- return __awaiter(this, arguments, void 0, function (param) {
160
- var args, response;
161
- if (param === void 0) { param = {}; }
162
- return __generator(this, function (_a) {
163
- switch (_a.label) {
164
- case 0:
165
- args = __assign(__assign(__assign({}, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
166
- return [4 /*yield*/, this.request({
167
- apiFn: this.api.getHomeTimelineRaw,
168
- convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.home, e.errors).homeTimelineUrt.instructions; },
169
- key: 'HomeTimeline',
170
- param: args,
171
- })];
172
- case 1:
173
- response = _a.sent();
174
- return [2 /*return*/, response];
175
- }
176
- });
105
+ return response;
106
+ }
107
+ async getUserTweets(param) {
108
+ const args = {
109
+ userId: param.userId,
110
+ ...(param.count == undefined ? {} : { count: param.count }),
111
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
112
+ ...param.extraParam,
113
+ };
114
+ const response = await this.request({
115
+ apiFn: this.api.getUserTweetsRaw,
116
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.user?.result.timeline.timeline, e.errors).instructions,
117
+ key: 'UserTweets',
118
+ param: args,
177
119
  });
178
- };
179
- TweetApiUtils.prototype.getHomeLatestTimeline = function () {
180
- return __awaiter(this, arguments, void 0, function (param) {
181
- var args, response;
182
- if (param === void 0) { param = {}; }
183
- return __generator(this, function (_a) {
184
- switch (_a.label) {
185
- case 0:
186
- args = __assign(__assign(__assign({}, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
187
- return [4 /*yield*/, this.request({
188
- apiFn: this.api.getHomeLatestTimelineRaw,
189
- convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.home, e.errors).homeTimelineUrt.instructions; },
190
- key: 'HomeLatestTimeline',
191
- param: args,
192
- })];
193
- case 1:
194
- response = _a.sent();
195
- return [2 /*return*/, response];
196
- }
197
- });
120
+ return response;
121
+ }
122
+ async getUserOriginalsTimeline(param) {
123
+ const args = {
124
+ userId: param.userId,
125
+ ...(param.count == undefined ? {} : { count: param.count }),
126
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
127
+ ...param.extraParam,
128
+ };
129
+ const response = await this.request({
130
+ apiFn: this.api.getUserOriginalsTimelineRaw,
131
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.user?.result.timeline.timeline, e.errors).instructions,
132
+ key: 'UserOriginalsTimeline',
133
+ param: args,
198
134
  });
199
- };
200
- TweetApiUtils.prototype.getListLatestTweetsTimeline = function (param) {
201
- return __awaiter(this, void 0, void 0, function () {
202
- var args, response;
203
- return __generator(this, function (_a) {
204
- switch (_a.label) {
205
- case 0:
206
- args = __assign(__assign(__assign({ listId: param.listId }, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
207
- return [4 /*yield*/, this.request({
208
- apiFn: this.api.getListLatestTweetsTimelineRaw,
209
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.list) === null || _a === void 0 ? void 0 : _a.tweetsTimeline.timeline, e.errors).instructions; },
210
- key: 'ListLatestTweetsTimeline',
211
- param: args,
212
- })];
213
- case 1:
214
- response = _a.sent();
215
- return [2 /*return*/, response];
216
- }
217
- });
135
+ return response;
136
+ }
137
+ async getUserRepliesTimeline(param) {
138
+ const args = {
139
+ userId: param.userId,
140
+ ...(param.count == undefined ? {} : { count: param.count }),
141
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
142
+ ...param.extraParam,
143
+ };
144
+ const response = await this.request({
145
+ apiFn: this.api.getUserRepliesTimelineRaw,
146
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.user?.result.timeline.timeline, e.errors).instructions,
147
+ key: 'UserRepliesTimeline',
148
+ param: args,
218
149
  });
219
- };
220
- TweetApiUtils.prototype.getUserTweets = function (param) {
221
- return __awaiter(this, void 0, void 0, function () {
222
- var args, response;
223
- return __generator(this, function (_a) {
224
- switch (_a.label) {
225
- case 0:
226
- args = __assign(__assign(__assign({ userId: param.userId }, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
227
- return [4 /*yield*/, this.request({
228
- apiFn: this.api.getUserTweetsRaw,
229
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timeline.timeline, e.errors).instructions; },
230
- key: 'UserTweets',
231
- param: args,
232
- })];
233
- case 1:
234
- response = _a.sent();
235
- return [2 /*return*/, response];
236
- }
237
- });
150
+ return response;
151
+ }
152
+ async getUserVideoTimeline(param) {
153
+ const args = {
154
+ userId: param.userId,
155
+ ...(param.count == undefined ? {} : { count: param.count }),
156
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
157
+ ...param.extraParam,
158
+ };
159
+ const response = await this.request({
160
+ apiFn: this.api.getUserVideoTimelineRaw,
161
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.user?.result.timeline.timeline, e.errors).instructions,
162
+ key: 'UserVideoTimeline',
163
+ param: args,
238
164
  });
239
- };
240
- TweetApiUtils.prototype.getUserTweetsAndReplies = function (param) {
241
- return __awaiter(this, void 0, void 0, function () {
242
- var args, response;
243
- return __generator(this, function (_a) {
244
- switch (_a.label) {
245
- case 0:
246
- args = __assign(__assign(__assign({ userId: param.userId }, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
247
- return [4 /*yield*/, this.request({
248
- apiFn: this.api.getUserTweetsAndRepliesRaw,
249
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timeline.timeline, e.errors).instructions; },
250
- key: 'UserTweetsAndReplies',
251
- param: args,
252
- })];
253
- case 1:
254
- response = _a.sent();
255
- return [2 /*return*/, response];
256
- }
257
- });
165
+ return response;
166
+ }
167
+ async getUserTweetsAndReplies(param) {
168
+ const args = {
169
+ userId: param.userId,
170
+ ...(param.count == undefined ? {} : { count: param.count }),
171
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
172
+ ...param.extraParam,
173
+ };
174
+ const response = await this.request({
175
+ apiFn: this.api.getUserTweetsAndRepliesRaw,
176
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.user?.result.timeline.timeline, e.errors).instructions,
177
+ key: 'UserTweetsAndReplies',
178
+ param: args,
258
179
  });
259
- };
260
- TweetApiUtils.prototype.getUserMedia = function (param) {
261
- return __awaiter(this, void 0, void 0, function () {
262
- var args, response;
263
- return __generator(this, function (_a) {
264
- switch (_a.label) {
265
- case 0:
266
- args = __assign(__assign(__assign({ userId: param.userId }, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
267
- return [4 /*yield*/, this.request({
268
- apiFn: this.api.getUserMediaRaw,
269
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timeline.timeline, e.errors).instructions; },
270
- key: 'UserMedia',
271
- param: args,
272
- })];
273
- case 1:
274
- response = _a.sent();
275
- return [2 /*return*/, response];
276
- }
277
- });
180
+ return response;
181
+ }
182
+ async getUserMedia(param) {
183
+ const args = {
184
+ userId: param.userId,
185
+ ...(param.count == undefined ? {} : { count: param.count }),
186
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
187
+ ...param.extraParam,
188
+ };
189
+ const response = await this.request({
190
+ apiFn: this.api.getUserMediaRaw,
191
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.user?.result.timeline.timeline, e.errors).instructions,
192
+ key: 'UserMedia',
193
+ param: args,
278
194
  });
279
- };
280
- TweetApiUtils.prototype.getLikes = function (param) {
281
- return __awaiter(this, void 0, void 0, function () {
282
- var args, response;
283
- return __generator(this, function (_a) {
284
- switch (_a.label) {
285
- case 0:
286
- args = __assign(__assign(__assign({ userId: param.userId }, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
287
- return [4 /*yield*/, this.request({
288
- apiFn: this.api.getLikesRaw,
289
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timeline.timeline, e.errors).instructions; },
290
- key: 'Likes',
291
- param: args,
292
- })];
293
- case 1:
294
- response = _a.sent();
295
- return [2 /*return*/, response];
296
- }
297
- });
195
+ return response;
196
+ }
197
+ async getLikes(param) {
198
+ const args = {
199
+ userId: param.userId,
200
+ ...(param.count == undefined ? {} : { count: param.count }),
201
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
202
+ ...param.extraParam,
203
+ };
204
+ const response = await this.request({
205
+ apiFn: this.api.getLikesRaw,
206
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data.user?.result.timeline.timeline, e.errors).instructions,
207
+ key: 'Likes',
208
+ param: args,
298
209
  });
299
- };
300
- TweetApiUtils.prototype.getBookmarks = function () {
301
- return __awaiter(this, arguments, void 0, function (param) {
302
- var args, response;
303
- if (param === void 0) { param = {}; }
304
- return __generator(this, function (_a) {
305
- switch (_a.label) {
306
- case 0:
307
- args = __assign(__assign(__assign({}, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
308
- return [4 /*yield*/, this.request({
309
- apiFn: this.api.getBookmarksRaw,
310
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data) === null || _a === void 0 ? void 0 : _a.bookmarkTimelineV2.timeline, e.errors).instructions; },
311
- key: 'Bookmarks',
312
- param: args,
313
- })];
314
- case 1:
315
- response = _a.sent();
316
- return [2 /*return*/, response];
317
- }
318
- });
210
+ return response;
211
+ }
212
+ async getBookmarks(param = {}) {
213
+ const args = {
214
+ ...(param.count == undefined ? {} : { count: param.count }),
215
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
216
+ ...param.extraParam,
217
+ };
218
+ const response = await this.request({
219
+ apiFn: this.api.getBookmarksRaw,
220
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data?.bookmarkTimelineV2.timeline, e.errors).instructions,
221
+ key: 'Bookmarks',
222
+ param: args,
319
223
  });
320
- };
321
- TweetApiUtils.prototype.getCommunityTweetsTimeline = function (param) {
322
- return __awaiter(this, void 0, void 0, function () {
323
- var args, response;
324
- return __generator(this, function (_a) {
325
- switch (_a.label) {
326
- case 0:
327
- args = __assign(__assign(__assign(__assign({ communityId: param.communityId }, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), (param.rankingMode == undefined ? {} : { rankingMode: param.rankingMode })), param.extraParam);
328
- return [4 /*yield*/, this.request({
329
- apiFn: this.api.getCommunityTweetsTimelineRaw,
330
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data) === null || _a === void 0 ? void 0 : _a.communityResults.result.rankedCommunityTimeline.timeline, e.errors).instructions; },
331
- key: 'CommunityTweetsTimeline',
332
- param: args,
333
- })];
334
- case 1:
335
- response = _a.sent();
336
- return [2 /*return*/, response];
337
- }
338
- });
224
+ return response;
225
+ }
226
+ async getCommunityTweetsTimeline(param) {
227
+ const args = {
228
+ communityId: param.communityId,
229
+ ...(param.count == undefined ? {} : { count: param.count }),
230
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
231
+ ...(param.rankingMode == undefined ? {} : { rankingMode: param.rankingMode }),
232
+ ...param.extraParam,
233
+ };
234
+ const response = await this.request({
235
+ apiFn: this.api.getCommunityTweetsTimelineRaw,
236
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data?.communityResults.result.rankedCommunityTimeline.timeline, e.errors).instructions,
237
+ key: 'CommunityTweetsTimeline',
238
+ param: args,
339
239
  });
340
- };
341
- TweetApiUtils.prototype.getCommunityMediaTimeline = function (param) {
342
- return __awaiter(this, void 0, void 0, function () {
343
- var args, response;
344
- return __generator(this, function (_a) {
345
- switch (_a.label) {
346
- case 0:
347
- args = __assign(__assign(__assign({ communityId: param.communityId }, (param.count == undefined ? {} : { count: param.count })), (param.cursor == undefined ? {} : { cursor: param.cursor })), param.extraParam);
348
- return [4 /*yield*/, this.request({
349
- apiFn: this.api.getCommunityMediaTimelineRaw,
350
- convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data) === null || _a === void 0 ? void 0 : _a.communityResults.result.communityMediaTimeline.timeline, e.errors).instructions; },
351
- key: 'CommunityMediaTimeline',
352
- param: args,
353
- })];
354
- case 1:
355
- response = _a.sent();
356
- return [2 /*return*/, response];
357
- }
358
- });
240
+ return response;
241
+ }
242
+ async getCommunityMediaTimeline(param) {
243
+ const args = {
244
+ communityId: param.communityId,
245
+ ...(param.count == undefined ? {} : { count: param.count }),
246
+ ...(param.cursor == undefined ? {} : { cursor: param.cursor }),
247
+ ...param.extraParam,
248
+ };
249
+ const response = await this.request({
250
+ apiFn: this.api.getCommunityMediaTimelineRaw,
251
+ convertFn: (e) => (0, utils_1.errorCheck)(e.data?.communityResults.result.communityMediaTimeline.timeline, e.errors).instructions,
252
+ key: 'CommunityMediaTimeline',
253
+ param: args,
359
254
  });
360
- };
361
- return TweetApiUtils;
362
- }());
255
+ return response;
256
+ }
257
+ }
363
258
  exports.TweetApiUtils = TweetApiUtils;
364
259
  //# sourceMappingURL=tweetApi.js.map