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

User Management support #212

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Ignore IntelliJ projects
.idea
.settings/org.eclipse.jdt.core.prefs

# Ignore Eclipse projects
.project
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ WorkOS workos = new WorkOS("WORKOS_API_KEY");
// workos.passwordless
// workos.portal
// workos.sso
// workos.userManagement
// workos.webhooks
```

Expand All @@ -62,9 +63,23 @@ For our SDKs WorkOS follows a Semantic Versioning ([SemVer](https://semver.org/)

See full examples at https://github.com/workos-inc/java-example-applications.

## Beta Releases

WorkOS has features in Beta that can be accessed via Beta releases. We would love for you to try these
and share feedback with us before these features reach general availability (GA). To install a Beta version,
please follow the [installation steps](#installation) above using the Beta release version.

> Note: there can be breaking changes between Beta versions. Therefore, we recommend pinning the package version to a
> specific version. This way you can install the same version each time without breaking changes unless you are
> intentionally looking for the latest Beta version.
We highly recommend keeping an eye on when the Beta feature you are interested in goes from Beta to stable so that you
can move to using the stable version.

## More Information

- [Single Sign-On Guide](https://workos.com/docs/sso/guide)
- [Directory Sync Guide](https://workos.com/docs/directory-sync/guide)
- [User Management](https://workos.com/docs/user-management/guide)
- [Admin Portal Guide](https://workos.com/docs/admin-portal/guide)
- [Magic Link Guide](https://workos.com/docs/magic-link/guide)
11 changes: 11 additions & 0 deletions src/main/kotlin/com/workos/WorkOS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.workos.organizations.OrganizationsApi
import com.workos.passwordless.PasswordlessApi
import com.workos.portal.PortalApi
import com.workos.sso.SsoApi
import com.workos.usermanagement.UserManagementApi
import com.workos.webhooks.WebhooksApi
import org.apache.http.client.utils.URIBuilder
import java.lang.IllegalArgumentException
Expand Down Expand Up @@ -95,6 +96,12 @@ class WorkOS(
@JvmField
val mfa = MfaApi(this)

/**
* Module for interacting with the User Management API.
*/
@JvmField
val userManagement = UserManagementApi(this)

/**
* Module for interacting with the Webhooks API.
*/
Expand Down Expand Up @@ -255,17 +262,21 @@ class WorkOS(
val responseData = mapper.readValue(payload, BadRequestExceptionResponse::class.java)
throw BadRequestException(responseData.message, responseData.code, responseData.errors, requestId)
}

401 -> {
val responseData = mapper.readValue(payload, GenericErrorResponse::class.java)
throw UnauthorizedException(responseData.message, requestId)
}

404 -> {
throw NotFoundException(response.url.path, requestId)
}

422 -> {
val unprocessableEntityException = mapper.readValue(payload, UnprocessableEntityExceptionResponse::class.java)
throw UnprocessableEntityException(unprocessableEntityException.message, unprocessableEntityException.code, unprocessableEntityException.errors, requestId)
}

else -> {
val responseData = mapper.readValue(payload, GenericErrorResponse::class.java)
throw GenericServerException(responseData.message, status, requestId)
Expand Down
Loading