twitter-api-sdk
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -31,3 +31,3 @@ import { RequestOptions } from "../request"; | ||
*/ | ||
getUsersIdBookmarks: (id: string, params?: TwitterParams<getUsersIdBookmarks>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<getUsersIdBookmarks>>; | ||
getUsersIdBookmarks: (id: string, params?: TwitterParams<getUsersIdBookmarks>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<getUsersIdBookmarks>>; | ||
/** | ||
@@ -42,3 +42,3 @@ * Add Tweet to Bookmarks | ||
*/ | ||
postUsersIdBookmarks: (id: string, request_body: TwitterBody<postUsersIdBookmarks>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<postUsersIdBookmarks>>; | ||
postUsersIdBookmarks: (id: string, request_body: TwitterBody<postUsersIdBookmarks>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<postUsersIdBookmarks>>; | ||
/** | ||
@@ -53,3 +53,3 @@ * Remove a bookmarked Tweet | ||
*/ | ||
usersIdBookmarksDelete: (id: string, tweet_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdBookmarksDelete>>; | ||
usersIdBookmarksDelete: (id: string, tweet_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdBookmarksDelete>>; | ||
}; | ||
@@ -73,3 +73,3 @@ /** | ||
*/ | ||
listBatchComplianceJobs: (params: TwitterParams<listBatchComplianceJobs>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listBatchComplianceJobs>>; | ||
listBatchComplianceJobs: (params: TwitterParams<listBatchComplianceJobs>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listBatchComplianceJobs>>; | ||
/** | ||
@@ -83,3 +83,3 @@ * Create compliance job | ||
*/ | ||
createBatchComplianceJob: (request_body: TwitterBody<createBatchComplianceJob>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<createBatchComplianceJob>>; | ||
createBatchComplianceJob: (request_body: TwitterBody<createBatchComplianceJob>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<createBatchComplianceJob>>; | ||
/** | ||
@@ -93,3 +93,3 @@ * Get compliance job | ||
*/ | ||
getBatchComplianceJob: (id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<getBatchComplianceJob>>; | ||
getBatchComplianceJob: (id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<getBatchComplianceJob>>; | ||
}; | ||
@@ -112,3 +112,3 @@ /** | ||
*/ | ||
getOpenApiSpec: (request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<getOpenApiSpec>>; | ||
getOpenApiSpec: (request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<getOpenApiSpec>>; | ||
}; | ||
@@ -133,3 +133,3 @@ /** | ||
*/ | ||
userFollowedLists: (id: string, params?: TwitterParams<userFollowedLists>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<userFollowedLists>>; | ||
userFollowedLists: (id: string, params?: TwitterParams<userFollowedLists>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<userFollowedLists>>; | ||
/** | ||
@@ -144,3 +144,3 @@ * Follow a List | ||
*/ | ||
listUserFollow: (id: string, request_body: TwitterBody<listUserFollow>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listUserFollow>>; | ||
listUserFollow: (id: string, request_body: TwitterBody<listUserFollow>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listUserFollow>>; | ||
/** | ||
@@ -155,3 +155,3 @@ * Unfollow a List | ||
*/ | ||
listUserUnfollow: (id: string, list_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listUserUnfollow>>; | ||
listUserUnfollow: (id: string, list_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listUserUnfollow>>; | ||
/** | ||
@@ -166,3 +166,3 @@ * Get a User's List Memberships | ||
*/ | ||
getUserListMemberships: (id: string, params?: TwitterParams<getUserListMemberships>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<getUserListMemberships>>; | ||
getUserListMemberships: (id: string, params?: TwitterParams<getUserListMemberships>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<getUserListMemberships>>; | ||
/** | ||
@@ -177,3 +177,3 @@ * Get a User's Owned Lists | ||
*/ | ||
listUserOwnedLists: (id: string, params?: TwitterParams<listUserOwnedLists>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<listUserOwnedLists>>; | ||
listUserOwnedLists: (id: string, params?: TwitterParams<listUserOwnedLists>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<listUserOwnedLists>>; | ||
/** | ||
@@ -188,3 +188,3 @@ * Get a User's Pinned Lists | ||
*/ | ||
listUserPinnedLists: (id: string, params?: TwitterParams<listUserPinnedLists>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listUserPinnedLists>>; | ||
listUserPinnedLists: (id: string, params?: TwitterParams<listUserPinnedLists>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listUserPinnedLists>>; | ||
/** | ||
@@ -199,3 +199,3 @@ * Pin a List | ||
*/ | ||
listUserPin: (id: string, request_body: TwitterBody<listUserPin>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listUserPin>>; | ||
listUserPin: (id: string, request_body: TwitterBody<listUserPin>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listUserPin>>; | ||
/** | ||
@@ -210,3 +210,3 @@ * Unpin a List | ||
*/ | ||
listUserUnpin: (id: string, list_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listUserUnpin>>; | ||
listUserUnpin: (id: string, list_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listUserUnpin>>; | ||
/** | ||
@@ -220,3 +220,3 @@ * Create List | ||
*/ | ||
listIdCreate: (request_body: TwitterBody<listIdCreate>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listIdCreate>>; | ||
listIdCreate: (request_body: TwitterBody<listIdCreate>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listIdCreate>>; | ||
/** | ||
@@ -230,3 +230,3 @@ * Delete List | ||
*/ | ||
listIdDelete: (id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listIdDelete>>; | ||
listIdDelete: (id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listIdDelete>>; | ||
/** | ||
@@ -241,3 +241,3 @@ * Update List | ||
*/ | ||
listIdUpdate: (id: string, request_body: TwitterBody<listIdUpdate>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listIdUpdate>>; | ||
listIdUpdate: (id: string, request_body: TwitterBody<listIdUpdate>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listIdUpdate>>; | ||
/** | ||
@@ -252,3 +252,3 @@ * List lookup by List ID | ||
*/ | ||
listIdGet: (id: string, params?: TwitterParams<listIdGet>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listIdGet>>; | ||
listIdGet: (id: string, params?: TwitterParams<listIdGet>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listIdGet>>; | ||
/** | ||
@@ -263,3 +263,3 @@ * Add a List member | ||
*/ | ||
listAddMember: (id: string, request_body: TwitterBody<listAddMember>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listAddMember>>; | ||
listAddMember: (id: string, request_body: TwitterBody<listAddMember>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listAddMember>>; | ||
/** | ||
@@ -274,3 +274,3 @@ * Remove a List member | ||
*/ | ||
listRemoveMember: (id: string, user_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<listRemoveMember>>; | ||
listRemoveMember: (id: string, user_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<listRemoveMember>>; | ||
}; | ||
@@ -295,3 +295,3 @@ /** | ||
*/ | ||
findSpaceById: (id: string, params?: TwitterParams<findSpaceById>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findSpaceById>>; | ||
findSpaceById: (id: string, params?: TwitterParams<findSpaceById>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findSpaceById>>; | ||
/** | ||
@@ -305,3 +305,3 @@ * Space lookup up Space IDs | ||
*/ | ||
findSpacesByIds: (params: TwitterParams<findSpacesByIds>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findSpacesByIds>>; | ||
findSpacesByIds: (params: TwitterParams<findSpacesByIds>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findSpacesByIds>>; | ||
/** | ||
@@ -315,3 +315,3 @@ * Space lookup by their creators | ||
*/ | ||
findSpacesByCreatorIds: (params: TwitterParams<findSpacesByCreatorIds>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findSpacesByCreatorIds>>; | ||
findSpacesByCreatorIds: (params: TwitterParams<findSpacesByCreatorIds>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findSpacesByCreatorIds>>; | ||
/** | ||
@@ -325,3 +325,3 @@ * Search for Spaces | ||
*/ | ||
searchSpaces: (params: TwitterParams<searchSpaces>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<searchSpaces>>; | ||
searchSpaces: (params: TwitterParams<searchSpaces>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<searchSpaces>>; | ||
/** | ||
@@ -336,3 +336,3 @@ * Retrieve tweets from a Space | ||
*/ | ||
spaceTweets: (id: string, params?: TwitterParams<spaceTweets>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<spaceTweets>>; | ||
spaceTweets: (id: string, params?: TwitterParams<spaceTweets>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<spaceTweets>>; | ||
/** | ||
@@ -347,3 +347,3 @@ * Retrieve the list of users who purchased a ticket to the given space | ||
*/ | ||
spaceBuyers: (id: string, params?: TwitterParams<spaceBuyers>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<spaceBuyers>>; | ||
spaceBuyers: (id: string, params?: TwitterParams<spaceBuyers>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<spaceBuyers>>; | ||
}; | ||
@@ -367,3 +367,3 @@ /** | ||
*/ | ||
findTweetsById: (params: TwitterParams<findTweetsById>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findTweetsById>>; | ||
findTweetsById: (params: TwitterParams<findTweetsById>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findTweetsById>>; | ||
/** | ||
@@ -377,3 +377,3 @@ * Creation of a Tweet | ||
*/ | ||
createTweet: (request_body: TwitterBody<createTweet>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<createTweet>>; | ||
createTweet: (request_body: TwitterBody<createTweet>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<createTweet>>; | ||
/** | ||
@@ -388,3 +388,3 @@ * Tweet lookup by Tweet ID | ||
*/ | ||
findTweetById: (id: string, params?: TwitterParams<findTweetById>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findTweetById>>; | ||
findTweetById: (id: string, params?: TwitterParams<findTweetById>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findTweetById>>; | ||
/** | ||
@@ -398,3 +398,3 @@ * Tweet delete by Tweet ID | ||
*/ | ||
deleteTweetById: (id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<deleteTweetById>>; | ||
deleteTweetById: (id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<deleteTweetById>>; | ||
/** | ||
@@ -409,3 +409,3 @@ * Retrieve tweets that quote a tweet. | ||
*/ | ||
findTweetsThatQuoteATweet: (id: string, params?: TwitterParams<findTweetsThatQuoteATweet>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findTweetsThatQuoteATweet>>; | ||
findTweetsThatQuoteATweet: (id: string, params?: TwitterParams<findTweetsThatQuoteATweet>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findTweetsThatQuoteATweet>>; | ||
/** | ||
@@ -420,3 +420,3 @@ * Hide replies | ||
*/ | ||
hideReplyById: (id: string, request_body: TwitterBody<hideReplyById>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<hideReplyById>>; | ||
hideReplyById: (id: string, request_body: TwitterBody<hideReplyById>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<hideReplyById>>; | ||
/** | ||
@@ -430,3 +430,3 @@ * Recent search | ||
*/ | ||
tweetsRecentSearch: (params: TwitterParams<tweetsRecentSearch>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<tweetsRecentSearch>>; | ||
tweetsRecentSearch: (params: TwitterParams<tweetsRecentSearch>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<tweetsRecentSearch>>; | ||
/** | ||
@@ -440,3 +440,3 @@ * Full-archive search | ||
*/ | ||
tweetsFullarchiveSearch: (params: TwitterParams<tweetsFullarchiveSearch>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<tweetsFullarchiveSearch>>; | ||
tweetsFullarchiveSearch: (params: TwitterParams<tweetsFullarchiveSearch>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<tweetsFullarchiveSearch>>; | ||
/** | ||
@@ -450,3 +450,3 @@ * Filtered stream | ||
*/ | ||
searchStream: (params?: TwitterParams<searchStream>, request_options?: Partial<RequestOptions> | undefined) => AsyncGenerator<TwitterResponse<searchStream>>; | ||
searchStream: (params?: TwitterParams<searchStream>, request_options?: Partial<RequestOptions>) => AsyncGenerator<TwitterResponse<searchStream>>; | ||
/** | ||
@@ -460,3 +460,3 @@ * Rules lookup | ||
*/ | ||
getRules: (params?: TwitterParams<getRules>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<getRules>>; | ||
getRules: (params?: TwitterParams<getRules>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<getRules>>; | ||
/** | ||
@@ -471,3 +471,3 @@ * Add/Delete rules | ||
*/ | ||
addOrDeleteRules: (request_body: TwitterBody<addOrDeleteRules>, params?: TwitterParams<addOrDeleteRules>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<addOrDeleteRules>>; | ||
addOrDeleteRules: (request_body: TwitterBody<addOrDeleteRules>, params?: TwitterParams<addOrDeleteRules>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<addOrDeleteRules>>; | ||
/** | ||
@@ -481,3 +481,3 @@ * Sample stream | ||
*/ | ||
sampleStream: (params?: TwitterParams<sampleStream>, request_options?: Partial<RequestOptions> | undefined) => AsyncGenerator<TwitterResponse<sampleStream>>; | ||
sampleStream: (params?: TwitterParams<sampleStream>, request_options?: Partial<RequestOptions>) => AsyncGenerator<TwitterResponse<sampleStream>>; | ||
/** | ||
@@ -492,3 +492,3 @@ * User home timeline by User ID | ||
*/ | ||
usersIdTimeline: (id: string, params?: TwitterParams<usersIdTimeline>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdTimeline>>; | ||
usersIdTimeline: (id: string, params?: TwitterParams<usersIdTimeline>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdTimeline>>; | ||
/** | ||
@@ -503,3 +503,3 @@ * User Tweets timeline by User ID | ||
*/ | ||
usersIdTweets: (id: string, params?: TwitterParams<usersIdTweets>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdTweets>>; | ||
usersIdTweets: (id: string, params?: TwitterParams<usersIdTweets>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdTweets>>; | ||
/** | ||
@@ -514,3 +514,3 @@ * User mention timeline by User ID | ||
*/ | ||
usersIdMentions: (id: string, params?: TwitterParams<usersIdMentions>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdMentions>>; | ||
usersIdMentions: (id: string, params?: TwitterParams<usersIdMentions>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdMentions>>; | ||
/** | ||
@@ -525,3 +525,3 @@ * Causes the user (in the path) to like the specified tweet | ||
*/ | ||
usersIdLike: (id: string, request_body: TwitterBody<usersIdLike>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdLike>>; | ||
usersIdLike: (id: string, request_body: TwitterBody<usersIdLike>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdLike>>; | ||
/** | ||
@@ -536,3 +536,3 @@ * Causes the user (in the path) to unlike the specified tweet | ||
*/ | ||
usersIdUnlike: (id: string, tweet_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdUnlike>>; | ||
usersIdUnlike: (id: string, tweet_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdUnlike>>; | ||
/** | ||
@@ -547,3 +547,3 @@ * Returns Tweet objects liked by the provided User ID | ||
*/ | ||
usersIdLikedTweets: (id: string, params?: TwitterParams<usersIdLikedTweets>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdLikedTweets>>; | ||
usersIdLikedTweets: (id: string, params?: TwitterParams<usersIdLikedTweets>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdLikedTweets>>; | ||
/** | ||
@@ -558,3 +558,3 @@ * Causes the user (in the path) to retweet the specified tweet | ||
*/ | ||
usersIdRetweets: (id: string, request_body: TwitterBody<usersIdRetweets>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdRetweets>>; | ||
usersIdRetweets: (id: string, request_body: TwitterBody<usersIdRetweets>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdRetweets>>; | ||
/** | ||
@@ -569,3 +569,3 @@ * Causes the user (in the path) to unretweet the specified tweet | ||
*/ | ||
usersIdUnretweets: (id: string, source_tweet_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdUnretweets>>; | ||
usersIdUnretweets: (id: string, source_tweet_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdUnretweets>>; | ||
/** | ||
@@ -579,3 +579,3 @@ * Recent search counts | ||
*/ | ||
tweetCountsRecentSearch: (params: TwitterParams<tweetCountsRecentSearch>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<tweetCountsRecentSearch>>; | ||
tweetCountsRecentSearch: (params: TwitterParams<tweetCountsRecentSearch>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<tweetCountsRecentSearch>>; | ||
/** | ||
@@ -589,3 +589,3 @@ * Full archive search counts | ||
*/ | ||
tweetCountsFullArchiveSearch: (params: TwitterParams<tweetCountsFullArchiveSearch>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<tweetCountsFullArchiveSearch>>; | ||
tweetCountsFullArchiveSearch: (params: TwitterParams<tweetCountsFullArchiveSearch>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<tweetCountsFullArchiveSearch>>; | ||
/** | ||
@@ -600,3 +600,3 @@ * List Tweets timeline by List ID | ||
*/ | ||
listsIdTweets: (id: string, params?: TwitterParams<listsIdTweets>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<listsIdTweets>>; | ||
listsIdTweets: (id: string, params?: TwitterParams<listsIdTweets>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<listsIdTweets>>; | ||
}; | ||
@@ -620,3 +620,3 @@ /** | ||
*/ | ||
findUsersById: (params: TwitterParams<findUsersById>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findUsersById>>; | ||
findUsersById: (params: TwitterParams<findUsersById>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findUsersById>>; | ||
/** | ||
@@ -631,3 +631,3 @@ * User lookup by ID | ||
*/ | ||
findUserById: (id: string, params?: TwitterParams<findUserById>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findUserById>>; | ||
findUserById: (id: string, params?: TwitterParams<findUserById>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findUserById>>; | ||
/** | ||
@@ -641,3 +641,3 @@ * User lookup by usernames | ||
*/ | ||
findUsersByUsername: (params: TwitterParams<findUsersByUsername>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findUsersByUsername>>; | ||
findUsersByUsername: (params: TwitterParams<findUsersByUsername>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findUsersByUsername>>; | ||
/** | ||
@@ -651,3 +651,3 @@ * User lookup me | ||
*/ | ||
findMyUser: (params?: TwitterParams<findMyUser>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findMyUser>>; | ||
findMyUser: (params?: TwitterParams<findMyUser>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findMyUser>>; | ||
/** | ||
@@ -662,3 +662,3 @@ * User lookup by username | ||
*/ | ||
findUserByUsername: (username: string, params?: TwitterParams<findUserByUsername>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<findUserByUsername>>; | ||
findUserByUsername: (username: string, params?: TwitterParams<findUserByUsername>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<findUserByUsername>>; | ||
/** | ||
@@ -673,3 +673,3 @@ * Block User by User ID | ||
*/ | ||
usersIdBlock: (id: string, request_body: TwitterBody<usersIdBlock>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdBlock>>; | ||
usersIdBlock: (id: string, request_body: TwitterBody<usersIdBlock>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdBlock>>; | ||
/** | ||
@@ -684,3 +684,3 @@ * Returns user objects that are blocked by provided user ID | ||
*/ | ||
usersIdBlocking: (id: string, params?: TwitterParams<usersIdBlocking>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdBlocking>>; | ||
usersIdBlocking: (id: string, params?: TwitterParams<usersIdBlocking>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdBlocking>>; | ||
/** | ||
@@ -695,3 +695,3 @@ * Unblock User by User ID | ||
*/ | ||
usersIdUnblock: (source_user_id: string, target_user_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdUnblock>>; | ||
usersIdUnblock: (source_user_id: string, target_user_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdUnblock>>; | ||
/** | ||
@@ -706,3 +706,3 @@ * Unmute User by User ID | ||
*/ | ||
usersIdUnmute: (source_user_id: string, target_user_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdUnmute>>; | ||
usersIdUnmute: (source_user_id: string, target_user_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdUnmute>>; | ||
/** | ||
@@ -717,3 +717,3 @@ * Mute User by User ID | ||
*/ | ||
usersIdMute: (id: string, request_body: TwitterBody<usersIdMute>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdMute>>; | ||
usersIdMute: (id: string, request_body: TwitterBody<usersIdMute>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdMute>>; | ||
/** | ||
@@ -728,3 +728,3 @@ * Returns user objects that are muted by the provided user ID | ||
*/ | ||
usersIdMuting: (id: string, params?: TwitterParams<usersIdMuting>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdMuting>>; | ||
usersIdMuting: (id: string, params?: TwitterParams<usersIdMuting>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdMuting>>; | ||
/** | ||
@@ -739,3 +739,3 @@ * Returns user objects that follow the provided user ID | ||
*/ | ||
usersIdFollowers: (id: string, params?: TwitterParams<usersIdFollowers>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdFollowers>>; | ||
usersIdFollowers: (id: string, params?: TwitterParams<usersIdFollowers>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdFollowers>>; | ||
/** | ||
@@ -750,3 +750,3 @@ * Following by User ID | ||
*/ | ||
usersIdFollowing: (id: string, params?: TwitterParams<usersIdFollowing>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<usersIdFollowing>>; | ||
usersIdFollowing: (id: string, params?: TwitterParams<usersIdFollowing>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<usersIdFollowing>>; | ||
/** | ||
@@ -761,3 +761,3 @@ * Follow User | ||
*/ | ||
usersIdFollow: (id: string, request_body: TwitterBody<usersIdFollow>, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdFollow>>; | ||
usersIdFollow: (id: string, request_body: TwitterBody<usersIdFollow>, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdFollow>>; | ||
/** | ||
@@ -772,3 +772,3 @@ * Unfollow User | ||
*/ | ||
usersIdUnfollow: (source_user_id: string, target_user_id: string, request_options?: Partial<RequestOptions> | undefined) => Promise<TwitterResponse<usersIdUnfollow>>; | ||
usersIdUnfollow: (source_user_id: string, target_user_id: string, request_options?: Partial<RequestOptions>) => Promise<TwitterResponse<usersIdUnfollow>>; | ||
/** | ||
@@ -783,3 +783,3 @@ * Returns user objects that have liked the provided Tweet ID | ||
*/ | ||
tweetsIdLikingUsers: (id: string, params?: TwitterParams<tweetsIdLikingUsers>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<tweetsIdLikingUsers>>; | ||
tweetsIdLikingUsers: (id: string, params?: TwitterParams<tweetsIdLikingUsers>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<tweetsIdLikingUsers>>; | ||
/** | ||
@@ -794,3 +794,3 @@ * Returns user objects that have retweeted the provided Tweet ID | ||
*/ | ||
tweetsIdRetweetingUsers: (id: string, params?: TwitterParams<tweetsIdRetweetingUsers>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<tweetsIdRetweetingUsers>>; | ||
tweetsIdRetweetingUsers: (id: string, params?: TwitterParams<tweetsIdRetweetingUsers>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<tweetsIdRetweetingUsers>>; | ||
/** | ||
@@ -805,3 +805,3 @@ * Returns user objects that follow a List by the provided List ID | ||
*/ | ||
listGetFollowers: (id: string, params?: TwitterParams<listGetFollowers>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<listGetFollowers>>; | ||
listGetFollowers: (id: string, params?: TwitterParams<listGetFollowers>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<listGetFollowers>>; | ||
/** | ||
@@ -816,4 +816,4 @@ * Returns user objects that are members of a List by the provided List ID | ||
*/ | ||
listGetMembers: (id: string, params?: TwitterParams<listGetMembers>, request_options?: Partial<RequestOptions> | undefined) => TwitterPaginatedResponse<TwitterResponse<listGetMembers>>; | ||
listGetMembers: (id: string, params?: TwitterParams<listGetMembers>, request_options?: Partial<RequestOptions>) => TwitterPaginatedResponse<TwitterResponse<listGetMembers>>; | ||
}; | ||
} |
@@ -11,2 +11,11 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
let AbortController; | ||
if (!globalThis.AbortController) { | ||
AbortController = require("abort-controller"); | ||
} | ||
else { | ||
// https://nodejs.org/api/globals.html#class-abortcontroller | ||
// AbortController available in v14.17.0 as experimental | ||
AbortController = globalThis.AbortController; | ||
} | ||
async function fetchWithRetries(url, init, max_retries = 0) { | ||
@@ -26,2 +35,11 @@ const res = await (0, node_fetch_1.default)(url, init); | ||
} | ||
class TwitterResponseError extends Error { | ||
constructor(status, statusText, headers, error) { | ||
super(); | ||
this.status = status; | ||
this.statusText = statusText; | ||
this.headers = Object.fromEntries(headers); | ||
this.error = error; | ||
} | ||
} | ||
async function request({ auth, endpoint, params: query = {}, request_body, method, max_retries, base_url = "https://api.twitter.com", headers, ...options }) { | ||
@@ -36,3 +54,3 @@ const url = new URL(base_url + endpoint); | ||
headers: { | ||
"User-Agent": `twitter-api-typescript-sdk/1.0.7`, | ||
"User-Agent": `twitter-api-typescript-sdk/1.0.8`, | ||
...(isPost | ||
@@ -52,3 +70,4 @@ ? { "Content-Type": "application/json; charset=utf-8" } | ||
if (!response.ok) { | ||
throw new Error(`${response.status}, ${response.statusText}`); | ||
const error = await response.json(); | ||
throw new TwitterResponseError(response.status, response.statusText, response.headers, error); | ||
} | ||
@@ -59,17 +78,26 @@ return response; | ||
async function* stream(args) { | ||
const { body } = await request(args); | ||
const controller = new AbortController(); | ||
const { body } = await request({ | ||
signal: controller.signal, | ||
...args, | ||
}); | ||
if (body === null) | ||
throw new Error("No response returned from stream"); | ||
let buf = ""; | ||
for await (const chunk of body) { | ||
buf += chunk.toString(); | ||
const lines = buf.split("\r\n"); | ||
for (const [i, line] of lines.entries()) { | ||
if (i === lines.length - 1) { | ||
buf = line; | ||
try { | ||
for await (const chunk of body) { | ||
buf += chunk.toString(); | ||
const lines = buf.split("\r\n"); | ||
for (const [i, line] of lines.entries()) { | ||
if (i === lines.length - 1) { | ||
buf = line; | ||
} | ||
else if (line) | ||
yield JSON.parse(line); | ||
} | ||
else if (line) | ||
yield JSON.parse(line); | ||
} | ||
} | ||
finally { | ||
controller.abort(); | ||
} | ||
} | ||
@@ -76,0 +104,0 @@ exports.stream = stream; |
{ | ||
"name": "twitter-api-sdk", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A TypeScript SDK for the Twitter API", | ||
@@ -19,2 +19,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"abort-controller": "^3.0.0", | ||
"node-fetch": "^2.6.1" | ||
@@ -26,4 +27,4 @@ }, | ||
"devDependencies": { | ||
"@types/jest": "^27.4.1", | ||
"@types/node-fetch": "^2.6.1", | ||
"@types/jest": "^27.4.1", | ||
"jest": "^27.5.1", | ||
@@ -30,0 +31,0 @@ "nock": "^13.2.4", |
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
303089
6027
2
+ Addedabort-controller@^3.0.0
+ Addedabort-controller@3.0.0(transitive)
+ Addedevent-target-shim@5.0.1(transitive)