fix(events): add missing order parameter to listEvents#1524
Merged
Conversation
The WorkOS API accepts an `order` param on GET /events but the SDK did not expose it. Add `order?: 'asc' | 'desc'` to ListEventOptions and SerializedListEventOptions, pass it through the serializer, and add a test verifying it is sent in the query string.
Contributor
Greptile SummaryThis PR adds the missing
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller as SDK Caller
participant ListEvents as workos.events.listEvents()
participant Serializer as serializeListEventOptions()
participant API as WorkOS API (GET /events)
Caller->>ListEvents: { events: [...], order: 'desc' }
ListEvents->>Serializer: ListEventOptions
Serializer-->>ListEvents: { events, order: 'desc', ... }
ListEvents->>API: GET /events?events=...&order=desc
API-->>ListEvents: ListResponse<EventResponse>
ListEvents-->>Caller: ListResponse<Event>
Last reviewed commit: "fix(events): add mis..." |
gjtorikian
approved these changes
Mar 18, 2026
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.
Summary
The WorkOS API docs list
orderas a valid parameter for the List Events endpoint (GET /events), acceptingascordesc. The Node SDK'slistEventsmethod did not expose this parameter, preventing users from sorting events without manually constructing requests. This adds theorderfield to theListEventOptionsandSerializedListEventOptionsinterfaces and passes it through the serializer.What was tested
Automated
order: 'desc'is sent as a query parameterManual
SDK-only repo with no browser-testable application. Verification performed via unit tests, build, lint, typecheck, and format checks. Playwright N/A for pure library packages.
Verification
N/A -- this is a pure SDK library change with no UI. Verified through unit tests confirming the
orderparameter is correctly serialized and sent in the API request query string.Manual reproduction steps
main, callworkos.events.listEvents({ events: ['connection.activated'], order: 'desc' })-- TypeScript rejects theorderproperty (not in interface)?order=descto the APInpm test src/events/events.spec.tsto see the new test pass (6/6)Issue
Closes #1523
Follow-ups
None