Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix list endpoints #236

Merged
merged 3 commits into from
Jun 21, 2024
Merged

Fix list endpoints #236

merged 3 commits into from
Jun 21, 2024

Conversation

PaulAsjes
Copy link
Contributor

Description

Don't be fooled by the line count, it's mostly my editor fixing spacing issues.

data gets passed into a request which is then used to form the request body. In the case of a GET though there isn't a body, but there can be URL parameters. Data was being passed into list endpoints for UM, but because there is no body with a GET it was being ignored.

This fixes that by parsing data as a map and using it as URL parameters for list requests.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

Copy link
Contributor

@mattgd mattgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the code here, but I noticed all the List*Options classes have Jackson JSON annotations. Wondering if those are even useful or potentially just misleading and can be removed?

Comment on lines +28 to +40
val params =
(obj::class as KClass<T>).memberProperties.associate { prop: KProperty1<T, *> ->
prop.name.toSnakeCase() to
prop.get(obj)?.let { value ->
if (value::class.isData) {
toMap(value)
} else {
value.toString()
}
}
}

return params.filterValues { it != null }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely ☕

@PaulAsjes
Copy link
Contributor Author

To be honest, I have no idea why those annotations are in there. I'd rather not remove them though till we understand why there were put there in the first place.

@PaulAsjes PaulAsjes merged commit 67d88e2 into beta Jun 21, 2024
2 checks passed
@PaulAsjes PaulAsjes deleted the fix-list-endpoints branch June 21, 2024 09:48
PaulAsjes added a commit that referenced this pull request Jul 19, 2024
* User Management support (#212)

* Add Beta SDKs section in README.md (#213)

* Add Beta SDKs section in README.md

* Nit/typo

* Nit in section about Beta releases in the README.md (#214)

* Nit in section about Beta releases in the README.md

* Improvement to README.md

* Update README.md

* User Management support

* Update version (#215)

* Add Beta SDKs section in README.md (#213)

* Add Beta SDKs section in README.md

* Nit/typo

* Nit in section about Beta releases in the README.md (#214)

* Nit in section about Beta releases in the README.md

* Improvement to README.md

* Update README.md

* Update version

* Fix release script (Beta branch) (#217)

* Add Beta SDKs section in README.md (#213)

* Add Beta SDKs section in README.md

* Nit/typo

* Nit in section about Beta releases in the README.md (#214)

* Nit in section about Beta releases in the README.md

* Improvement to README.md

* Update README.md

* Fix typo in release script

* Add organization membership events (#218)

Add organization membership events.

* Update beta version (#219)

* Add events and API changes for invitations and Magic Auth (#221)

* Add events and API changes for invitations and Magic Auth

* Fix failing test

* Rename event data

* v3.1.0-beta.user-management3 (#222)

* Add organization membership deactivate and reactivate API methods. (#226)

* Bump to version 3.1.0-beta.user-management4. (#227)

* Add methods and events for email verification and password reset (#228)

* v3.1.0-beta.user-management5 (#229)

* Add find invitation by token method (#230)

* Fix list endpoints (#236)

* Now correctly parsing data as params for GET requests

* Value has to be a string

* lol linting

* 3.1.0-beta.user-management6 (#233)

* `invitationCode` should be `invitationToken` (#237)

---------

Co-authored-by: amadeo <165715960+amadeo-workos@users.noreply.github.com>
Co-authored-by: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com>
Co-authored-by: Blair Lunceford <74257063+blairlunceford@users.noreply.github.com>
Co-authored-by: Michael Hadley <m@mthadley.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants