Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twitter-openapi-typescript

Package Overview
Dependencies
Maintainers
0
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-openapi-typescript - npm Package Compare versions

Comparing version 0.0.43 to 0.0.44

17

dist/src/apis/defaultApi.js

@@ -60,5 +60,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var apiFn, args, response, checked, _a, data;
return __generator(this, function (_b) {
switch (_b.label) {
var apiFn, args, response, data, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -69,8 +69,7 @@ apiFn = param.apiFn.bind(this.api);

case 1:
response = _b.sent();
_a = utils_1.errorCheck;
response = _c.sent();
_b = (_a = param).convertFn;
return [4 /*yield*/, response.value()];
case 2:
checked = _a.apply(void 0, [_b.sent()]);
data = param.convertFn(checked);
data = _b.apply(_a, [_c.sent()]);
return [2 /*return*/, {

@@ -95,3 +94,3 @@ raw: { response: response.raw },

apiFn: this.api.getProfileSpotlightsQueryRaw,
convertFn: function (value) { return value.data.userResultByScreenName; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.userResultByScreenName, e.errors); },
param: args,

@@ -116,3 +115,3 @@ })];

apiFn: this.api.getTweetResultByRestIdRaw,
convertFn: function (value) { return (0, utils_1.buildTweetApiUtils)({ result: value.data.tweetResult }); },
convertFn: function (e) { return (0, utils_1.errorCheck)((0, utils_1.buildTweetApiUtils)({ result: (0, utils_1.errorCheck)(e.data.tweetResult, e.errors) }), e.errors); },
param: args,

@@ -119,0 +118,0 @@ })];

@@ -53,6 +53,6 @@ import { DefaultFlag, TwitterApiUtilsResponse, initOverrides } from '../models';

postDeleteRetweet(param: PostDeleteRetweetParam): Promise<TwitterApiUtilsResponse<i.DeleteRetweetResponse>>;
postFavoriteTweet(param: PostFavoriteTweetParam): Promise<TwitterApiUtilsResponse<i.FavoriteTweetResponseData>>;
postUnfavoriteTweet(param: PostUnfavoriteTweetParam): Promise<TwitterApiUtilsResponse<i.UnfavoriteTweetResponseData>>;
postFavoriteTweet(param: PostFavoriteTweetParam): Promise<TwitterApiUtilsResponse<i.FavoriteTweetResponse>>;
postUnfavoriteTweet(param: PostUnfavoriteTweetParam): Promise<TwitterApiUtilsResponse<i.UnfavoriteTweetResponse>>;
}
export {};
//# sourceMappingURL=postApi.d.ts.map

@@ -62,6 +62,6 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var args, queryId, features, variables, response, a, _a;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
var args, queryId, features, variables, response, a;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -103,12 +103,11 @@ args = __assign({ tweetText: param.tweetText }, param.extraParam);

case 1:
response = _c.sent();
response = _b.sent();
a = (0, twitter_openapi_typescript_generated_1.PostCreateTweetRequestVariablesToJSON)(variables);
_b = {
_a = {
raw: { response: response.raw },
header: (0, utils_1.buildHeader)(response.raw.headers)
};
_a = utils_1.errorCheck;
return [4 /*yield*/, response.value()];
case 2: return [2 /*return*/, (_b.data = _a.apply(void 0, [_c.sent()]),
_b)];
case 2: return [2 /*return*/, (_a.data = _b.sent(),
_a)];
}

@@ -120,6 +119,6 @@ });

return __awaiter(this, void 0, void 0, function () {
var args, queryId, variables, response, _a;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
var args, queryId, variables, response;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -137,11 +136,10 @@ args = __assign({ tweetId: param.tweetId }, param.extraParam);

case 1:
response = _c.sent();
_b = {
response = _b.sent();
_a = {
raw: { response: response.raw },
header: (0, utils_1.buildHeader)(response.raw.headers)
};
_a = utils_1.errorCheck;
return [4 /*yield*/, response.value()];
case 2: return [2 /*return*/, (_b.data = _a.apply(void 0, [_c.sent()]),
_b)];
case 2: return [2 /*return*/, (_a.data = _b.sent(),
_a)];
}

@@ -153,6 +151,6 @@ });

return __awaiter(this, void 0, void 0, function () {
var args, queryId, variables, response, _a;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
var args, queryId, variables, response;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -170,11 +168,10 @@ args = __assign({ tweetId: param.tweetId }, param.extraParam);

case 1:
response = _c.sent();
_b = {
response = _b.sent();
_a = {
raw: { response: response.raw },
header: (0, utils_1.buildHeader)(response.raw.headers)
};
_a = utils_1.errorCheck;
return [4 /*yield*/, response.value()];
case 2: return [2 /*return*/, (_b.data = _a.apply(void 0, [_c.sent()]),
_b)];
case 2: return [2 /*return*/, (_a.data = _b.sent(),
_a)];
}

@@ -186,6 +183,6 @@ });

return __awaiter(this, void 0, void 0, function () {
var args, queryId, variables, response, _a;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
var args, queryId, variables, response;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -203,11 +200,10 @@ args = __assign({ sourceTweetId: param.sourceTweetId }, param.extraParam);

case 1:
response = _c.sent();
_b = {
response = _b.sent();
_a = {
raw: { response: response.raw },
header: (0, utils_1.buildHeader)(response.raw.headers)
};
_a = utils_1.errorCheck;
return [4 /*yield*/, response.value()];
case 2: return [2 /*return*/, (_b.data = _a.apply(void 0, [_c.sent()]),
_b)];
case 2: return [2 /*return*/, (_a.data = _b.sent(),
_a)];
}

@@ -219,6 +215,6 @@ });

return __awaiter(this, void 0, void 0, function () {
var args, queryId, variables, response, _a;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
var args, queryId, variables, response;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -236,11 +232,10 @@ args = __assign({ tweetId: param.tweetId }, param.extraParam);

case 1:
response = _c.sent();
_b = {
response = _b.sent();
_a = {
raw: { response: response.raw },
header: (0, utils_1.buildHeader)(response.raw.headers)
};
_a = utils_1.errorCheck;
return [4 /*yield*/, response.value()];
case 2: return [2 /*return*/, (_b.data = _a.apply(void 0, [_c.sent()]),
_b)];
case 2: return [2 /*return*/, (_a.data = _b.sent(),
_a)];
}

@@ -252,6 +247,6 @@ });

return __awaiter(this, void 0, void 0, function () {
var args, queryId, variables, response, _a;
var _b;
return __generator(this, function (_c) {
switch (_c.label) {
var args, queryId, variables, response;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -269,11 +264,10 @@ args = __assign({ tweetId: param.tweetId }, param.extraParam);

case 1:
response = _c.sent();
_b = {
response = _b.sent();
_a = {
raw: { response: response.raw },
header: (0, utils_1.buildHeader)(response.raw.headers)
};
_a = utils_1.errorCheck;
return [4 /*yield*/, response.value()];
case 2: return [2 /*return*/, (_b.data = _a.apply(void 0, [_c.sent()]),
_b)];
case 2: return [2 /*return*/, (_a.data = _b.sent(),
_a)];
}

@@ -280,0 +274,0 @@ });

@@ -85,5 +85,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var apiFn, args, response, checked, _a, instruction, entry, data;
return __generator(this, function (_b) {
switch (_b.label) {
var apiFn, args, response, instruction, _a, _b, entry, data;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -94,8 +94,7 @@ apiFn = param.apiFn.bind(this.api);

case 1:
response = _b.sent();
_a = utils_1.errorCheck;
response = _c.sent();
_b = (_a = param).convertFn;
return [4 /*yield*/, response.value()];
case 2:
checked = _a.apply(void 0, [_b.sent()]);
instruction = param.convertFn(checked);
instruction = _b.apply(_a, [_c.sent()]);
entry = (0, utils_1.instructionToEntry)(instruction);

@@ -130,3 +129,3 @@ data = __spreadArray(__spreadArray([], __read((0, utils_1.tweetEntriesConverter)(entry)), false), __read((0, utils_1.instructionConverter)(instruction)), false);

apiFn: this.api.getTweetDetailRaw,
convertFn: function (e) { return e.data.threadedConversationWithInjectionsV2.instructions; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.threadedConversationWithInjectionsV2, e.errors).instructions; },
key: 'TweetDetail',

@@ -151,3 +150,3 @@ param: args,

apiFn: this.api.getSearchTimelineRaw,
convertFn: function (e) { return e.data.searchByRawQuery.searchTimeline.timeline.instructions; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.searchByRawQuery, e.errors).searchTimeline.timeline.instructions; },
key: 'SearchTimeline',

@@ -173,3 +172,3 @@ param: args,

apiFn: this.api.getHomeTimelineRaw,
convertFn: function (e) { return e.data.home.homeTimelineUrt.instructions; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.home, e.errors).homeTimelineUrt.instructions; },
key: 'HomeTimeline',

@@ -195,3 +194,3 @@ param: args,

apiFn: this.api.getHomeLatestTimelineRaw,
convertFn: function (e) { return e.data.home.homeTimelineUrt.instructions; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.home, e.errors).homeTimelineUrt.instructions; },
key: 'HomeLatestTimeline',

@@ -216,3 +215,3 @@ param: args,

apiFn: this.api.getListLatestTweetsTimelineRaw,
convertFn: function (e) { var _a, _b; return (_b = (_a = e.data.list.tweetsTimeline.timeline) === null || _a === void 0 ? void 0 : _a.instructions) !== null && _b !== void 0 ? _b : []; },
convertFn: function (e) { var _a, _b; return (_b = (0, utils_1.errorCheck)((_a = e.data.list) === null || _a === void 0 ? void 0 : _a.tweetsTimeline.timeline, e.errors).instructions) !== null && _b !== void 0 ? _b : []; },
key: 'ListLatestTweetsTimeline',

@@ -237,3 +236,3 @@ param: args,

apiFn: this.api.getUserTweetsRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.user.result.timelineV2.timeline).instructions; },
convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timelineV2.timeline, e.errors).instructions; },
key: 'UserTweets',

@@ -258,3 +257,3 @@ param: args,

apiFn: this.api.getUserTweetsAndRepliesRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.user.result.timelineV2.timeline).instructions; },
convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timelineV2.timeline, e.errors).instructions; },
key: 'UserTweetsAndReplies',

@@ -279,3 +278,3 @@ param: args,

apiFn: this.api.getUserMediaRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.user.result.timelineV2.timeline).instructions; },
convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timelineV2.timeline, e.errors).instructions; },
key: 'UserMedia',

@@ -300,3 +299,3 @@ param: args,

apiFn: this.api.getLikesRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.user.result.timelineV2.timeline).instructions; },
convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.user) === null || _a === void 0 ? void 0 : _a.result.timelineV2.timeline, e.errors).instructions; },
key: 'Likes',

@@ -322,3 +321,3 @@ param: args,

apiFn: this.api.getBookmarksRaw,
convertFn: function (e) { return e.data.bookmarkTimelineV2.timeline.instructions; },
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; },
key: 'Bookmarks',

@@ -325,0 +324,0 @@ param: args,

@@ -60,5 +60,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var apiFn, args, response, checked, _a, result, user;
return __generator(this, function (_b) {
switch (_b.label) {
var apiFn, args, response, result, _a, _b, user;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -69,8 +69,7 @@ apiFn = param.apiFn.bind(this.api);

case 1:
response = _b.sent();
_a = utils_1.errorCheck;
response = _c.sent();
_b = (_a = param).convertFn;
return [4 /*yield*/, response.value()];
case 2:
checked = _a.apply(void 0, [_b.sent()]);
result = param.convertFn(checked);
result = _b.apply(_a, [_c.sent()]);
user = result.result && (0, utils_1.userOrNullConverter)(result.result);

@@ -97,3 +96,3 @@ return [2 /*return*/, {

apiFn: this.api.getUserByScreenNameRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.user); },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.user, e.errors); },
param: args,

@@ -113,3 +112,3 @@ });

apiFn: this.api.getUserByRestIdRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.user); },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.user, e.errors); },
param: args,

@@ -116,0 +115,0 @@ });

@@ -60,5 +60,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var apiFn, args, response, checked, _a, instruction, entry, userList, data;
return __generator(this, function (_b) {
switch (_b.label) {
var apiFn, args, response, instruction, _a, _b, entry, userList, data;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -69,8 +69,7 @@ apiFn = param.apiFn.bind(this.api);

case 1:
response = _b.sent();
_a = utils_1.errorCheck;
response = _c.sent();
_b = (_a = param).convertFn;
return [4 /*yield*/, response.value()];
case 2:
checked = _a.apply(void 0, [_b.sent()]);
instruction = param.convertFn(checked);
instruction = _b.apply(_a, [_c.sent()]);
entry = (0, utils_1.instructionToEntry)(instruction);

@@ -106,3 +105,3 @@ userList = (0, utils_1.userEntriesConverter)(entry);

apiFn: this.api.getFollowersRaw,
convertFn: function (e) { return e.data.user.result.timeline.timeline.instructions; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.user, e.errors).result.timeline.timeline.instructions; },
key: 'Followers',

@@ -127,3 +126,3 @@ param: args,

apiFn: this.api.getFollowingRaw,
convertFn: function (e) { return e.data.user.result.timeline.timeline.instructions; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.user, e.errors).result.timeline.timeline.instructions; },
key: 'Following',

@@ -148,3 +147,3 @@ param: args,

apiFn: this.api.getFollowersYouKnowRaw,
convertFn: function (e) { return e.data.user.result.timeline.timeline.instructions; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.user, e.errors).result.timeline.timeline.instructions; },
key: 'FollowersYouKnow',

@@ -169,3 +168,3 @@ param: args,

apiFn: this.api.getFavoritersRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.favoritersTimeline.timeline).instructions; },
convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.favoritersTimeline) === null || _a === void 0 ? void 0 : _a.timeline, e.errors).instructions; },
key: 'Favoriters',

@@ -190,3 +189,3 @@ param: args,

apiFn: this.api.getRetweetersRaw,
convertFn: function (e) { return (0, utils_1.nonNullable)(e.data.retweetersTimeline.timeline).instructions; },
convertFn: function (e) { var _a; return (0, utils_1.errorCheck)((_a = e.data.retweetersTimeline) === null || _a === void 0 ? void 0 : _a.timeline, e.errors).instructions; },
key: 'Retweeters',

@@ -193,0 +192,0 @@ param: args,

@@ -60,5 +60,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var apiFn, args, response, checked, _a, result, user;
return __generator(this, function (_b) {
switch (_b.label) {
var apiFn, args, response, result, _a, _b, user;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -69,8 +69,7 @@ apiFn = param.apiFn.bind(this.api);

case 1:
response = _b.sent();
_a = utils_1.errorCheck;
response = _c.sent();
_b = (_a = param).convertFn;
return [4 /*yield*/, response.value()];
case 2:
checked = _a.apply(void 0, [_b.sent()]);
result = param.convertFn(checked);
result = _b.apply(_a, [_c.sent()]);
user = (0, utils_1.userResultConverter)(result);

@@ -94,3 +93,3 @@ return [2 /*return*/, {

apiFn: this.api.getUsersByRestIdsRaw,
convertFn: function (e) { return e.data.users; },
convertFn: function (e) { return (0, utils_1.errorCheck)(e.data.users, e.errors); },
param: args,

@@ -97,0 +96,0 @@ });

@@ -5,3 +5,3 @@ import * as i from 'twitter-openapi-typescript-generated';

export type RequestParam<T1, T2> = {
apiFn: ApiFunction<i.Errors | T2>;
apiFn: ApiFunction<T2>;
convertFn: (arg0: T2) => T1;

@@ -8,0 +8,0 @@ key: string;

import { ApiUtilsHeader, CursorApiUtilsResponse, TweetApiUtilsData, UserApiUtilsData } from '../models';
import * as i from 'twitter-openapi-typescript-generated';
export declare const nonNullable: <T>(x: T | undefined) => T;
export declare const getKwargs: (flag: {

@@ -9,3 +8,3 @@ [key: string]: any;

}) => any;
export declare const errorCheck: <T>(data: i.Errors | T) => T;
export declare const errorCheck: <T>(data: T | undefined, error: i.ErrorResponse[] | undefined) => T;
export declare const instructionToEntry: (item: i.InstructionUnion[]) => i.TimelineAddEntry[];

@@ -12,0 +11,0 @@ export declare const instructionConverter: (item: i.InstructionUnion[]) => TweetApiUtilsData[];

@@ -14,11 +14,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.buildHeader = exports.buildCursor = exports.entriesCursor = exports.userResultConverter = exports.userEntriesConverter = exports.userOrNullConverter = exports.tweetResultsConverter = exports.buildTweetApiUtils = exports.moduleConverter = exports.tweetEntriesConverter = exports.instructionConverter = exports.instructionToEntry = exports.errorCheck = exports.getKwargs = exports.nonNullable = void 0;
exports.buildHeader = exports.buildCursor = exports.entriesCursor = exports.userResultConverter = exports.userEntriesConverter = exports.userOrNullConverter = exports.tweetResultsConverter = exports.buildTweetApiUtils = exports.moduleConverter = exports.tweetEntriesConverter = exports.instructionConverter = exports.instructionToEntry = exports.errorCheck = exports.getKwargs = void 0;
var i = require("twitter-openapi-typescript-generated");
var nonNullable = function (x) {
if (x == undefined) {
throw Error('No data');
}
return x;
};
exports.nonNullable = nonNullable;
var getKwargs = function (flag, additional) {

@@ -38,11 +31,8 @@ var kwargs = { pathQueryId: flag.queryId };

exports.getKwargs = getKwargs;
var errorCheck = function (data) {
var res = data;
if (res.data != undefined) {
return res;
var errorCheck = function (data, error) {
var _a;
if (data == undefined) {
throw Error((_a = error === null || error === void 0 ? void 0 : error.map(function (e) { return e.message; }).join(', ')) !== null && _a !== void 0 ? _a : 'No data');
}
else if (res.error != undefined) {
throw Error(res.errors[0].message);
}
throw Error();
return data;
};

@@ -179,2 +169,5 @@ exports.errorCheck = errorCheck;

}
else if (userResults.typename == undefined) {
return userResults; // error
}
};

@@ -181,0 +174,0 @@ exports.userOrNullConverter = userOrNullConverter;

{
"name": "twitter-openapi-typescript",
"version": "0.0.43",
"version": "0.0.44",
"description": "Implementation of Twitter internal API in TypeScript",

@@ -24,3 +24,3 @@ "scripts": {

"dependencies": {
"twitter-openapi-typescript-generated": "^0.0.27"
"twitter-openapi-typescript-generated": "^0.0.31"
},

@@ -27,0 +27,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc