Repository navigation
feat(v2): missing common endpoints and OAuth 1.0a token exchange - #656
Merged
Merged
Conversation
Users search, retweets of a tweet, retweets of me, get and delete a DM event, DM block and unblock, pinned lists, usage credits, trends by WOEID and personalized trends, stream rule counts, streaming connections (list, terminate all, terminate by endpoint), and exchangeOAuth1Token() for OAuth 1.0a to OAuth 2.0 migration.
Owner
Author
|
Shipped in 1.31.0 |
markharding
pushed a commit
to futo-org/Harbor
that referenced
this pull request
Nov 3, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [twitter-api-v2](https://github.com/plhery/node-twitter-api-v2) | [`1.29.1` → `1.31.0`](https://renovatebot.com/diffs/npm/twitter-api-v2/1.29.1/1.31.0) |  |  | --- ### Release Notes <details> <summary>plhery/node-twitter-api-v2 (twitter-api-v2)</summary> ### [`v1.31.0`](https://github.com/plhery/node-twitter-api-v2/blob/HEAD/changelog.md#1310) [Compare Source](plhery/node-twitter-api-v2@1.30.0...1.31.0) - docs: fix wrong snippets, add a credentials guide and common errors [#​654](plhery/node-twitter-api-v2#654) ([@​plhery](https://github.com/plhery)) - fix(stream): close() stops pending reconnections, for await survives reconnections [#​655](plhery/node-twitter-api-v2#655) ([@​plhery](https://github.com/plhery)) - feat(v2): missing common endpoints and OAuth 1.0a token exchange [#​656](plhery/node-twitter-api-v2#656) ([@​plhery](https://github.com/plhery)) - fix(paginators): stop at the last page, and dedupe merged includes [#​651](plhery/node-twitter-api-v2#651) ([@​plhery](https://github.com/plhery)) - feat(types): bring the v2 types up to date with X's docs [#​653](plhery/node-twitter-api-v2#653) ([@​plhery](https://github.com/plhery)) - fix(errors): match v2 problem types, explain X's errors, reject cut responses [#​652](plhery/node-twitter-api-v2#652) ([@​plhery](https://github.com/plhery)) - fix(client): retry a failed current user fetch, plugin hook errors, cloneWithPrefix() [#​650](plhery/node-twitter-api-v2#650) ([@​plhery](https://github.com/plhery)) - fix: TwitterApiReadOnly and TwitterApiReadWrite named imports crashed on Node 22 [#​649](plhery/node-twitter-api-v2#649) ([@​plhery](https://github.com/plhery)) - fix: encode URL parameters, so that an ID can't change the endpoint [#​648](plhery/node-twitter-api-v2#648) ([@​plhery](https://github.com/plhery)) - test: a fake X API for offline tests, CI on pull requests [#​647](plhery/node-twitter-api-v2#647) ([@​plhery](https://github.com/plhery)) ### [`v1.30.0`](https://github.com/plhery/node-twitter-api-v2/blob/HEAD/changelog.md#1300) [Compare Source](plhery/node-twitter-api-v2@1.29.2...1.30.0) - fix(paginators): v1 searchUsers fetchNext() and fetchLast() kept asking for page 2 [#​644](plhery/node-twitter-api-v2#644) ([@​plhery](https://github.com/plhery)) - fix(types): tweet entity lists and user description entities are optional [#​645](plhery/node-twitter-api-v2#645) ([@​plhery](https://github.com/plhery)) - feat(media): report the upload progress of v2.uploadMedia with onProgress [#​646](plhery/node-twitter-api-v2#646) ([@​plhery](https://github.com/plhery)) - refactor: remove the redundant socket close listener of requests [#​643](plhery/node-twitter-api-v2#643) ([@​plhery](https://github.com/plhery)) - fix: ApiRequestError.requestError was always undefined [#​642](plhery/node-twitter-api-v2#642) ([@​plhery](https://github.com/plhery)) - docs: deprecate retired v1.1 and Labs methods, flag Enterprise-only endpoints [#​641](plhery/node-twitter-api-v2#641) ([@​plhery](https://github.com/plhery)) - fix: reject instead of hanging when a compressed response fails [#​640](plhery/node-twitter-api-v2#640) ([@​plhery](https://github.com/plhery)) - feat(media): accept file paths and handles in v2.uploadMedia [#​639](plhery/node-twitter-api-v2#639) ([@​plhery](https://github.com/plhery)) ### [`v1.29.2`](https://github.com/plhery/node-twitter-api-v2/blob/HEAD/changelog.md#1292) [Compare Source](plhery/node-twitter-api-v2@1.29.1...1.29.2) - fix(paginators): keep oldest_id when fetchNext() returns an empty page [#​638](plhery/node-twitter-api-v2#638) ([@​plhery](https://github.com/plhery)) - fix(stream): don't drop a payload whose CRLF separator arrives alone [#​638](plhery/node-twitter-api-v2#638) ([@​plhery](https://github.com/plhery)) - fix(paginators): keep the cursor when previous() returns an empty page [#​637](plhery/node-twitter-api-v2#637) ([@​OsamaAnsar](https://github.com/OsamaAnsar)) - fix(stream): decode chunks with a stateful UTF-8 decoder [#​636](plhery/node-twitter-api-v2#636) ([@​OsamaAnsar](https://github.com/OsamaAnsar)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xODguMiIsInVwZGF0ZWRJblZlciI6IjQ0LjE4OC4yIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/2162
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds commonly needed X API v2 endpoints that the library was missing, each checked against X's OpenAPI spec:
searchUsers(query), with its own paginator, since this endpoint pages withnext_token.retweets(tweetId)(the retweets of a tweet) andretweetsOfMe().dmEvent(id),deleteDmEvent(id),blockDms(userId)andunblockDms(userId).listsPinned(loggedUserId).usageCredits(), the pay-per-use balance.trendsByWoeid(woeid)andpersonalizedTrends().streamRuleCounts();streamConnections(),terminateAllStreamConnections()andterminateStreamConnections(endpoint), to close a connection left open, the cause of the 429TooManyConnections.exchangeOAuth1Token({ accessToken, accessSecret })moves OAuth 1.0a users to OAuth 2.0 without asking them to log in again (X docs). It sends what X documents: a form body, with a Basic header for confidential clients, orclient_idin the body for public ones.The deprecated v1 methods that now have a v2 equivalent point to it. The new methods are documented in doc/v2.md, doc/streaming.md and doc/auth.md.
Each one has a row in
test/endpoints.test.ts(method, path, query, auth scheme) against the fake X. There are also tests for thenext_tokenpaging of user search, and for the token exchange of confidential and public clients. All 17 new tests fail without the change.Left out: deleting connections by UUID, which needs a DELETE request with a body, and the request maker never sends one. User search has no
previous_tokenparameter, sofetchPrevious()on it sends the previous token asnext_token. That's a guess.