twitter-openapi-typescript 0.0.4 → 0.0.6

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 (53) hide show
  1. package/README.md +37 -11
  2. package/dist/src/api.d.ts +41 -33
  3. package/dist/src/api.d.ts.map +1 -1
  4. package/dist/src/api.js +239 -151
  5. package/dist/src/api.js.map +1 -1
  6. package/dist/src/apis/defaultApi.d.ts +17 -17
  7. package/dist/src/apis/defaultApi.js +106 -106
  8. package/dist/src/apis/index.d.ts +9 -9
  9. package/dist/src/apis/index.js +21 -21
  10. package/dist/src/apis/initialStateApi.d.ts +2 -2
  11. package/dist/src/apis/initialStateApi.js +9 -9
  12. package/dist/src/apis/postApi.d.ts +51 -51
  13. package/dist/src/apis/postApi.js +236 -236
  14. package/dist/src/apis/tweetApi.d.ts +88 -88
  15. package/dist/src/apis/tweetApi.js +277 -277
  16. package/dist/src/apis/userApi.d.ts +17 -17
  17. package/dist/src/apis/userApi.js +101 -101
  18. package/dist/src/apis/userListApi.d.ts +28 -28
  19. package/dist/src/apis/userListApi.js +135 -135
  20. package/dist/src/apis/v11GetApi.d.ts +7 -7
  21. package/dist/src/apis/v11GetApi.js +11 -11
  22. package/dist/src/apis/v11PostApi.d.ts +22 -22
  23. package/dist/src/apis/v11PostApi.js +93 -93
  24. package/dist/src/apis/v20GetApi.d.ts +7 -7
  25. package/dist/src/apis/v20GetApi.js +11 -11
  26. package/dist/src/index.d.ts +4 -4
  27. package/dist/src/index.js +20 -20
  28. package/dist/src/models/api.d.ts +17 -17
  29. package/dist/src/models/api.js +130 -130
  30. package/dist/src/models/index.d.ts +2 -2
  31. package/dist/src/models/index.js +18 -18
  32. package/dist/src/models/type.d.ts +15 -15
  33. package/dist/src/models/type.js +2 -2
  34. package/dist/src/types/flag.d.ts +5 -5
  35. package/dist/src/types/flag.js +2 -2
  36. package/dist/src/types/header.d.ts +14 -14
  37. package/dist/src/types/header.js +2 -2
  38. package/dist/src/types/index.d.ts +7 -7
  39. package/dist/src/types/index.js +23 -23
  40. package/dist/src/types/response.d.ts +9 -9
  41. package/dist/src/types/response.js +2 -2
  42. package/dist/src/types/timeline.d.ts +10 -10
  43. package/dist/src/types/timeline.js +2 -2
  44. package/dist/src/types/tweet.d.ts +17 -17
  45. package/dist/src/types/tweet.js +2 -2
  46. package/dist/src/types/user.d.ts +10 -10
  47. package/dist/src/types/user.js +2 -2
  48. package/dist/src/types/user_list.d.ts +12 -12
  49. package/dist/src/types/user_list.js +2 -2
  50. package/package.json +4 -4
  51. package/src/api.ts +91 -35
  52. package/test/api/defaultApi.test.ts +0 -1
  53. package/test/init.ts +2 -2
@@ -1,102 +1,102 @@
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;
24
- return g = { next: verb(0), "throw": verb(1), "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
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.UserApiUtils = void 0;
51
- var models_1 = require("../models");
52
- var UserApiUtils = /** @class */ (function () {
53
- function UserApiUtils(api, flag) {
54
- this.api = api;
55
- this.flag = flag;
56
- }
57
- UserApiUtils.prototype.request = function (param) {
58
- return __awaiter(this, void 0, void 0, function () {
59
- var apiFn, response, user, _a, _b;
60
- return __generator(this, function (_c) {
61
- switch (_c.label) {
62
- case 0:
63
- apiFn = param.apiFn.bind(this.api);
64
- return [4 /*yield*/, apiFn({
65
- queryId: this.flag[param.key]['queryId'],
66
- variables: JSON.stringify(__assign(__assign({}, this.flag[param.key]['variables']), param)),
67
- features: JSON.stringify(this.flag[param.key]['features']),
68
- })];
69
- case 1:
70
- response = _c.sent();
71
- _b = (_a = param).convertFn;
72
- return [4 /*yield*/, response.value()];
73
- case 2:
74
- user = _b.apply(_a, [_c.sent()]);
75
- return [2 /*return*/, {
76
- raw: { response: response.raw },
77
- header: (0, models_1.buildHeader)(response.raw.headers),
78
- data: user.result,
79
- }];
80
- }
81
- });
82
- });
83
- };
84
- UserApiUtils.prototype.getUserByScreenName = function (param) {
85
- return __awaiter(this, void 0, void 0, function () {
86
- var args, response;
87
- return __generator(this, function (_a) {
88
- args = __assign({ screenName: param.screenName }, param.extraParam);
89
- response = this.request({
90
- key: 'UserByScreenName',
91
- apiFn: this.api.getUserByScreenNameRaw,
92
- convertFn: function (e) { return e.data.user; },
93
- param: args,
94
- });
95
- return [2 /*return*/, response];
96
- });
97
- });
98
- };
99
- return UserApiUtils;
100
- }());
101
- exports.UserApiUtils = UserApiUtils;
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;
24
+ return g = { next: verb(0), "throw": verb(1), "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
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.UserApiUtils = void 0;
51
+ var models_1 = require("../models");
52
+ var UserApiUtils = /** @class */ (function () {
53
+ function UserApiUtils(api, flag) {
54
+ this.api = api;
55
+ this.flag = flag;
56
+ }
57
+ UserApiUtils.prototype.request = function (param) {
58
+ return __awaiter(this, void 0, void 0, function () {
59
+ var apiFn, response, user, _a, _b;
60
+ return __generator(this, function (_c) {
61
+ switch (_c.label) {
62
+ case 0:
63
+ apiFn = param.apiFn.bind(this.api);
64
+ return [4 /*yield*/, apiFn({
65
+ queryId: this.flag[param.key]['queryId'],
66
+ variables: JSON.stringify(__assign(__assign({}, this.flag[param.key]['variables']), param)),
67
+ features: JSON.stringify(this.flag[param.key]['features']),
68
+ })];
69
+ case 1:
70
+ response = _c.sent();
71
+ _b = (_a = param).convertFn;
72
+ return [4 /*yield*/, response.value()];
73
+ case 2:
74
+ user = _b.apply(_a, [_c.sent()]);
75
+ return [2 /*return*/, {
76
+ raw: { response: response.raw },
77
+ header: (0, models_1.buildHeader)(response.raw.headers),
78
+ data: user.result,
79
+ }];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ UserApiUtils.prototype.getUserByScreenName = function (param) {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ var args, response;
87
+ return __generator(this, function (_a) {
88
+ args = __assign({ screenName: param.screenName }, param.extraParam);
89
+ response = this.request({
90
+ key: 'UserByScreenName',
91
+ apiFn: this.api.getUserByScreenNameRaw,
92
+ convertFn: function (e) { return e.data.user; },
93
+ param: args,
94
+ });
95
+ return [2 /*return*/, response];
96
+ });
97
+ });
98
+ };
99
+ return UserApiUtils;
100
+ }());
101
+ exports.UserApiUtils = UserApiUtils;
102
102
  //# sourceMappingURL=userApi.js.map
@@ -1,29 +1,29 @@
1
- import * as i from 'twitter-openapi-typescript-generated';
2
- import { DefaultFlag, UserListApiUtilsResponse } from '../types';
3
- import { RequestParam } from '../models';
4
- type GetFollowers = {
5
- userId: string;
6
- cursor?: string;
7
- count?: number;
8
- extraParam?: {
9
- [key: string]: any;
10
- };
11
- };
12
- type GetFollowing = {
13
- userId: string;
14
- cursor?: string;
15
- count?: number;
16
- extraParam?: {
17
- [key: string]: any;
18
- };
19
- };
20
- export declare class UserListApiUtils {
21
- api: i.UserListApi;
22
- flag: DefaultFlag;
23
- constructor(api: i.UserListApi, flag: DefaultFlag);
24
- request<T>(param: RequestParam<i.InstructionUnion[], T>): Promise<UserListApiUtilsResponse>;
25
- getFollowers(param: GetFollowers): Promise<UserListApiUtilsResponse>;
26
- getFollowing(param: GetFollowing): Promise<UserListApiUtilsResponse>;
27
- }
28
- export {};
1
+ import * as i from 'twitter-openapi-typescript-generated';
2
+ import { DefaultFlag, UserListApiUtilsResponse } from '../types';
3
+ import { RequestParam } from '../models';
4
+ type GetFollowers = {
5
+ userId: string;
6
+ cursor?: string;
7
+ count?: number;
8
+ extraParam?: {
9
+ [key: string]: any;
10
+ };
11
+ };
12
+ type GetFollowing = {
13
+ userId: string;
14
+ cursor?: string;
15
+ count?: number;
16
+ extraParam?: {
17
+ [key: string]: any;
18
+ };
19
+ };
20
+ export declare class UserListApiUtils {
21
+ api: i.UserListApi;
22
+ flag: DefaultFlag;
23
+ constructor(api: i.UserListApi, flag: DefaultFlag);
24
+ request<T>(param: RequestParam<i.InstructionUnion[], T>): Promise<UserListApiUtilsResponse>;
25
+ getFollowers(param: GetFollowers): Promise<UserListApiUtilsResponse>;
26
+ getFollowing(param: GetFollowing): Promise<UserListApiUtilsResponse>;
27
+ }
28
+ export {};
29
29
  //# sourceMappingURL=userListApi.d.ts.map
@@ -1,136 +1,136 @@
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;
24
- return g = { next: verb(0), "throw": verb(1), "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
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.UserListApiUtils = void 0;
51
- var models_1 = require("../models");
52
- var UserListApiUtils = /** @class */ (function () {
53
- function UserListApiUtils(api, flag) {
54
- this.api = api;
55
- this.flag = flag;
56
- }
57
- UserListApiUtils.prototype.request = function (param) {
58
- return __awaiter(this, void 0, void 0, function () {
59
- var apiFn, response, instruction, _a, _b, entry, userList, data, raw;
60
- return __generator(this, function (_c) {
61
- switch (_c.label) {
62
- case 0:
63
- apiFn = param.apiFn.bind(this.api);
64
- return [4 /*yield*/, apiFn({
65
- queryId: this.flag[param.key]['queryId'],
66
- variables: JSON.stringify(__assign(__assign({}, this.flag[param.key]['variables']), param)),
67
- features: JSON.stringify(this.flag[param.key]['features']),
68
- })];
69
- case 1:
70
- response = _c.sent();
71
- _b = (_a = param).convertFn;
72
- return [4 /*yield*/, response.value()];
73
- case 2:
74
- instruction = _b.apply(_a, [_c.sent()]);
75
- entry = (0, models_1.instructionToEntry)(instruction);
76
- userList = (0, models_1.userEntriesConverter)(entry);
77
- data = userList.map(function (user) { return (0, models_1.buildUserResponse)(user); });
78
- raw = {
79
- response: response.raw,
80
- instruction: instruction,
81
- entry: entry,
82
- };
83
- return [2 /*return*/, {
84
- raw: raw,
85
- header: (0, models_1.buildHeader)(response.raw.headers),
86
- cursor: (0, models_1.entriesCursor)(entry),
87
- data: data,
88
- }];
89
- }
90
- });
91
- });
92
- };
93
- UserListApiUtils.prototype.getFollowers = function (param) {
94
- return __awaiter(this, void 0, void 0, function () {
95
- var args, response;
96
- return __generator(this, function (_a) {
97
- switch (_a.label) {
98
- case 0:
99
- args = __assign(__assign(__assign({ userId: param.userId }, (param.cursor == null ? {} : { cursor: param.cursor })), (param.count == null ? {} : { count: param.count })), param.extraParam);
100
- return [4 /*yield*/, this.request({
101
- apiFn: this.api.getFollowersRaw,
102
- convertFn: function (e) { return e.data.user.result.timeline.timeline.instructions; },
103
- key: 'Followers',
104
- param: args,
105
- })];
106
- case 1:
107
- response = _a.sent();
108
- return [2 /*return*/, response];
109
- }
110
- });
111
- });
112
- };
113
- UserListApiUtils.prototype.getFollowing = function (param) {
114
- return __awaiter(this, void 0, void 0, function () {
115
- var args, response;
116
- return __generator(this, function (_a) {
117
- switch (_a.label) {
118
- case 0:
119
- args = __assign(__assign(__assign({ userId: param.userId }, (param.cursor == null ? {} : { cursor: param.cursor })), (param.count == null ? {} : { count: param.count })), param.extraParam);
120
- return [4 /*yield*/, this.request({
121
- apiFn: this.api.getFollowingRaw,
122
- convertFn: function (e) { return e.data.user.result.timeline.timeline.instructions; },
123
- key: 'Following',
124
- param: args,
125
- })];
126
- case 1:
127
- response = _a.sent();
128
- return [2 /*return*/, response];
129
- }
130
- });
131
- });
132
- };
133
- return UserListApiUtils;
134
- }());
135
- exports.UserListApiUtils = UserListApiUtils;
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;
24
+ return g = { next: verb(0), "throw": verb(1), "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
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.UserListApiUtils = void 0;
51
+ var models_1 = require("../models");
52
+ var UserListApiUtils = /** @class */ (function () {
53
+ function UserListApiUtils(api, flag) {
54
+ this.api = api;
55
+ this.flag = flag;
56
+ }
57
+ UserListApiUtils.prototype.request = function (param) {
58
+ return __awaiter(this, void 0, void 0, function () {
59
+ var apiFn, response, instruction, _a, _b, entry, userList, data, raw;
60
+ return __generator(this, function (_c) {
61
+ switch (_c.label) {
62
+ case 0:
63
+ apiFn = param.apiFn.bind(this.api);
64
+ return [4 /*yield*/, apiFn({
65
+ queryId: this.flag[param.key]['queryId'],
66
+ variables: JSON.stringify(__assign(__assign({}, this.flag[param.key]['variables']), param)),
67
+ features: JSON.stringify(this.flag[param.key]['features']),
68
+ })];
69
+ case 1:
70
+ response = _c.sent();
71
+ _b = (_a = param).convertFn;
72
+ return [4 /*yield*/, response.value()];
73
+ case 2:
74
+ instruction = _b.apply(_a, [_c.sent()]);
75
+ entry = (0, models_1.instructionToEntry)(instruction);
76
+ userList = (0, models_1.userEntriesConverter)(entry);
77
+ data = userList.map(function (user) { return (0, models_1.buildUserResponse)(user); });
78
+ raw = {
79
+ response: response.raw,
80
+ instruction: instruction,
81
+ entry: entry,
82
+ };
83
+ return [2 /*return*/, {
84
+ raw: raw,
85
+ header: (0, models_1.buildHeader)(response.raw.headers),
86
+ cursor: (0, models_1.entriesCursor)(entry),
87
+ data: data,
88
+ }];
89
+ }
90
+ });
91
+ });
92
+ };
93
+ UserListApiUtils.prototype.getFollowers = function (param) {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ var args, response;
96
+ return __generator(this, function (_a) {
97
+ switch (_a.label) {
98
+ case 0:
99
+ args = __assign(__assign(__assign({ userId: param.userId }, (param.cursor == null ? {} : { cursor: param.cursor })), (param.count == null ? {} : { count: param.count })), param.extraParam);
100
+ return [4 /*yield*/, this.request({
101
+ apiFn: this.api.getFollowersRaw,
102
+ convertFn: function (e) { return e.data.user.result.timeline.timeline.instructions; },
103
+ key: 'Followers',
104
+ param: args,
105
+ })];
106
+ case 1:
107
+ response = _a.sent();
108
+ return [2 /*return*/, response];
109
+ }
110
+ });
111
+ });
112
+ };
113
+ UserListApiUtils.prototype.getFollowing = function (param) {
114
+ return __awaiter(this, void 0, void 0, function () {
115
+ var args, response;
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0:
119
+ args = __assign(__assign(__assign({ userId: param.userId }, (param.cursor == null ? {} : { cursor: param.cursor })), (param.count == null ? {} : { count: param.count })), param.extraParam);
120
+ return [4 /*yield*/, this.request({
121
+ apiFn: this.api.getFollowingRaw,
122
+ convertFn: function (e) { return e.data.user.result.timeline.timeline.instructions; },
123
+ key: 'Following',
124
+ param: args,
125
+ })];
126
+ case 1:
127
+ response = _a.sent();
128
+ return [2 /*return*/, response];
129
+ }
130
+ });
131
+ });
132
+ };
133
+ return UserListApiUtils;
134
+ }());
135
+ exports.UserListApiUtils = UserListApiUtils;
136
136
  //# sourceMappingURL=userListApi.js.map
@@ -1,8 +1,8 @@
1
- import * as i from 'twitter-openapi-typescript-generated';
2
- import { DefaultFlag } from '../types';
3
- export declare class V11GetApiUtils {
4
- api: i.V11GetApi;
5
- flag: DefaultFlag;
6
- constructor(api: i.V11GetApi, flag: DefaultFlag);
7
- }
1
+ import * as i from 'twitter-openapi-typescript-generated';
2
+ import { DefaultFlag } from '../types';
3
+ export declare class V11GetApiUtils {
4
+ api: i.V11GetApi;
5
+ flag: DefaultFlag;
6
+ constructor(api: i.V11GetApi, flag: DefaultFlag);
7
+ }
8
8
  //# sourceMappingURL=v11GetApi.d.ts.map
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V11GetApiUtils = void 0;
4
- var V11GetApiUtils = /** @class */ (function () {
5
- function V11GetApiUtils(api, flag) {
6
- this.api = api;
7
- this.flag = flag;
8
- }
9
- return V11GetApiUtils;
10
- }());
11
- exports.V11GetApiUtils = V11GetApiUtils;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.V11GetApiUtils = void 0;
4
+ var V11GetApiUtils = /** @class */ (function () {
5
+ function V11GetApiUtils(api, flag) {
6
+ this.api = api;
7
+ this.flag = flag;
8
+ }
9
+ return V11GetApiUtils;
10
+ }());
11
+ exports.V11GetApiUtils = V11GetApiUtils;
12
12
  //# sourceMappingURL=v11GetApi.js.map
@@ -1,23 +1,23 @@
1
- import * as i from 'twitter-openapi-typescript-generated';
2
- import { DefaultFlag, TwitterApiUtilsResponse } from '../types';
3
- type PostCreateFriendshipsParam = {
4
- userId: string;
5
- extraParam?: {
6
- [key: string]: any;
7
- };
8
- };
9
- type PostDestroyFriendshipsParam = {
10
- userId: string;
11
- extraParam?: {
12
- [key: string]: any;
13
- };
14
- };
15
- export declare class V11PostApiUtils {
16
- api: i.V11PostApi;
17
- flag: DefaultFlag;
18
- constructor(api: i.V11PostApi, flag: DefaultFlag);
19
- postCreateFriendships(param: PostCreateFriendshipsParam): Promise<TwitterApiUtilsResponse<undefined>>;
20
- postDestroyFriendships(param: PostDestroyFriendshipsParam): Promise<TwitterApiUtilsResponse<undefined>>;
21
- }
22
- export {};
1
+ import * as i from 'twitter-openapi-typescript-generated';
2
+ import { DefaultFlag, TwitterApiUtilsResponse } from '../types';
3
+ type PostCreateFriendshipsParam = {
4
+ userId: string;
5
+ extraParam?: {
6
+ [key: string]: any;
7
+ };
8
+ };
9
+ type PostDestroyFriendshipsParam = {
10
+ userId: string;
11
+ extraParam?: {
12
+ [key: string]: any;
13
+ };
14
+ };
15
+ export declare class V11PostApiUtils {
16
+ api: i.V11PostApi;
17
+ flag: DefaultFlag;
18
+ constructor(api: i.V11PostApi, flag: DefaultFlag);
19
+ postCreateFriendships(param: PostCreateFriendshipsParam): Promise<TwitterApiUtilsResponse<undefined>>;
20
+ postDestroyFriendships(param: PostDestroyFriendshipsParam): Promise<TwitterApiUtilsResponse<undefined>>;
21
+ }
22
+ export {};
23
23
  //# sourceMappingURL=v11PostApi.d.ts.map