twitter-openapi-typescript
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -207,3 +207,3 @@ "use strict"; | ||
_a = TwitterOpenApi; | ||
TwitterOpenApi.hash = '2d477a0fb84d249a30b5af535b467efc25b34923'; | ||
TwitterOpenApi.hash = '591bddfa4707b3c01a0b1ca081226e7c6ff230f8'; | ||
TwitterOpenApi.url = "https://raw.githubusercontent.com/fa0311/twitter-openapi/".concat(_a.hash, "/src/config/placeholder.json"); | ||
@@ -210,0 +210,0 @@ TwitterOpenApi.twitter = 'https://twitter.com/home'; |
import * as i from 'twitter-openapi-typescript-generated'; | ||
import { RequestParam, DefaultFlag, TwitterApiUtilsResponse } from '../models'; | ||
import { RequestParam, DefaultFlag, TwitterApiUtilsResponse, TweetApiUtilsData } from '../models'; | ||
export type ProfileSpotlightsQueryParam = { | ||
@@ -9,2 +9,8 @@ screenName: string; | ||
}; | ||
export type TweetResultByRestIdParam = { | ||
tweetId: string; | ||
extraParam?: { | ||
[key: string]: any; | ||
}; | ||
}; | ||
export declare class DefaultApiUtils { | ||
@@ -16,3 +22,4 @@ api: i.DefaultApi; | ||
getProfileSpotlightsQuery(param: ProfileSpotlightsQueryParam): Promise<TwitterApiUtilsResponse<i.UserResultByScreenName>>; | ||
getTweetResultByRestId(param: TweetResultByRestIdParam): Promise<TwitterApiUtilsResponse<TweetApiUtilsData>>; | ||
} | ||
//# sourceMappingURL=defaultApi.d.ts.map |
@@ -102,2 +102,22 @@ "use strict"; | ||
}; | ||
DefaultApiUtils.prototype.getTweetResultByRestId = function (param) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var args, response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
args = __assign({ tweetId: param.tweetId }, param.extraParam); | ||
return [4 /*yield*/, this.request({ | ||
key: 'TweetResultByRestId', | ||
apiFn: this.api.getTweetResultByRestIdRaw, | ||
convertFn: function (value) { return (0, utils_1.buildTweetApiUtils)({ result: value.data.tweetResult }); }, | ||
param: args, | ||
})]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return DefaultApiUtils; | ||
@@ -104,0 +124,0 @@ }()); |
{ | ||
"name": "twitter-openapi-typescript", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Implementation of Twitter internal API in TypeScript", | ||
@@ -25,3 +25,3 @@ "scripts": { | ||
"dependencies": { | ||
"twitter-openapi-typescript-generated": "^0.0.9" | ||
"twitter-openapi-typescript-generated": "^0.0.10" | ||
}, | ||
@@ -46,2 +46,2 @@ "devDependencies": { | ||
} | ||
} | ||
} |
@@ -31,3 +31,3 @@ import * as i from 'twitter-openapi-typescript-generated'; | ||
export class TwitterOpenApi { | ||
static hash = '2d477a0fb84d249a30b5af535b467efc25b34923'; | ||
static hash = '591bddfa4707b3c01a0b1ca081226e7c6ff230f8'; | ||
static url = `https://raw.githubusercontent.com/fa0311/twitter-openapi/${this.hash}/src/config/placeholder.json`; | ||
@@ -34,0 +34,0 @@ static twitter = 'https://twitter.com/home'; |
import * as i from 'twitter-openapi-typescript-generated'; | ||
import { buildHeader, errorCheck, getKwargs } from '@/utils'; | ||
import { RequestParam, DefaultFlag, TwitterApiUtilsResponse } from '@/models'; | ||
import { buildHeader, buildTweetApiUtils, errorCheck, getKwargs } from '@/utils'; | ||
import { RequestParam, DefaultFlag, TwitterApiUtilsResponse, TweetApiUtilsData } from '@/models'; | ||
@@ -10,2 +10,7 @@ export type ProfileSpotlightsQueryParam = { | ||
export type TweetResultByRestIdParam = { | ||
tweetId: string; | ||
extraParam?: { [key: string]: any }; | ||
}; | ||
export class DefaultApiUtils { | ||
@@ -49,2 +54,17 @@ api: i.DefaultApi; | ||
} | ||
async getTweetResultByRestId(param: TweetResultByRestIdParam): Promise<TwitterApiUtilsResponse<TweetApiUtilsData>> { | ||
const args = { | ||
tweetId: param.tweetId, | ||
...param.extraParam, | ||
}; | ||
const response = await this.request({ | ||
key: 'TweetResultByRestId', | ||
apiFn: this.api.getTweetResultByRestIdRaw, | ||
convertFn: (value) => buildTweetApiUtils({ result: value.data.tweetResult }), | ||
param: args, | ||
}); | ||
return response; | ||
} | ||
} |
import { getClient, logger } from '@test/init'; | ||
import { printTweet } from '@test/util'; | ||
@@ -13,1 +14,9 @@ test('getProfileSpotlightsQuery', async () => { | ||
}); | ||
test('getTweetResultByRestId', async () => { | ||
logger.log('getTweetResultByRestId'); | ||
const client = await getClient(); | ||
const response = await client.getDefaultApi().getTweetResultByRestId({ tweetId: '1349129669258448897' }); | ||
printTweet(response.data); | ||
expect(response.raw.response.ok).toBe(true); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257634
3783
+ Addedtwitter-openapi-typescript-generated@0.0.10(transitive)
- Removedtwitter-openapi-typescript-generated@0.0.9(transitive)