Skip to content

Commit

Permalink
User Management support
Browse files Browse the repository at this point in the history
  • Loading branch information
amadeo-workos committed Apr 25, 2024
1 parent a1b9b3a commit 437fbd4
Show file tree
Hide file tree
Showing 68 changed files with 4,212 additions and 0 deletions.
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
2 changes: 2 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 @@ -79,5 +80,6 @@ can move to using the stable version.

- [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

0 comments on commit 437fbd4

Please sign in to comment.