mirror of
https://github.com/LukeHagar/clerk-sdk-java.git
synced 2025-12-09 20:37:48 +00:00
233 lines
10 KiB
Markdown
233 lines
10 KiB
Markdown
# Clients
|
|
(*clients()*)
|
|
|
|
### Available Operations
|
|
|
|
* [~~list~~](#list) - List all clients :warning: **Deprecated**
|
|
* [verify](#verify) - Verify a client
|
|
* [get](#get) - Get a client
|
|
|
|
## ~~list~~
|
|
|
|
Returns a list of all clients. The clients are returned sorted by creation date,
|
|
with the newest clients appearing first.
|
|
Warning: the endpoint is being deprecated and will be removed in future versions.
|
|
|
|
> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
|
|
### Example Usage
|
|
|
|
```java
|
|
package hello.world;
|
|
|
|
import com.clerk.backend_api.Clerk;
|
|
import com.clerk.backend_api.models.components.*;
|
|
import com.clerk.backend_api.models.components.Security;
|
|
import com.clerk.backend_api.models.operations.*;
|
|
import com.clerk.backend_api.utils.EventStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigInteger;
|
|
import java.time.LocalDate;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.Optional;
|
|
import org.openapitools.jackson.nullable.JsonNullable;
|
|
import static java.util.Map.entry;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
Clerk sdk = Clerk.builder()
|
|
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
|
|
.build();
|
|
|
|
GetClientListResponse res = sdk.clients().list()
|
|
.limit(10L)
|
|
.offset(0L)
|
|
.call();
|
|
|
|
while (true) {
|
|
if (res.clientList().isPresent()) {
|
|
// handle response
|
|
Optional<GetClientListResponse> nextRes = res.next();
|
|
if (nextRes.isPresent()) {
|
|
res = nextRes.get();
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (com.clerk.backend_api.models.errors.SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `limit` | *Optional<? extends Long>* | :heavy_minus_sign: | Applies a limit to the number of results returned.<br/>Can be used for paginating the results together with `offset`. |
|
|
| `offset` | *Optional<? extends Long>* | :heavy_minus_sign: | Skip the first `offset` results when paginating.<br/>Needs to be an integer greater or equal to zero.<br/>To be used in conjunction with `limit`. |
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.GetClientListResponse>](../../models/operations/GetClientListResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------- | ------------------------- | ------------------------- |
|
|
| models/errors/ClerkErrors | 400,401,410,422 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|
|
|
|
## verify
|
|
|
|
Verifies the client in the provided token
|
|
|
|
### Example Usage
|
|
|
|
```java
|
|
package hello.world;
|
|
|
|
import com.clerk.backend_api.Clerk;
|
|
import com.clerk.backend_api.models.components.*;
|
|
import com.clerk.backend_api.models.components.Security;
|
|
import com.clerk.backend_api.models.operations.*;
|
|
import com.clerk.backend_api.utils.EventStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigInteger;
|
|
import java.time.LocalDate;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.Optional;
|
|
import org.openapitools.jackson.nullable.JsonNullable;
|
|
import static java.util.Map.entry;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
Clerk sdk = Clerk.builder()
|
|
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
|
|
.build();
|
|
|
|
VerifyClientRequestBody req = VerifyClientRequestBody.builder()
|
|
.build();
|
|
|
|
VerifyClientResponse res = sdk.clients().verify()
|
|
.request(req)
|
|
.call();
|
|
|
|
if (res.client().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (com.clerk.backend_api.models.errors.SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
| `request` | [com.clerk.backend_api.models.operations.VerifyClientRequestBody](../../models/operations/VerifyClientRequestBody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.VerifyClientResponse>](../../models/operations/VerifyClientResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------- | ------------------------- | ------------------------- |
|
|
| models/errors/ClerkErrors | 400,401,404 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|
|
|
|
## get
|
|
|
|
Returns the details of a client.
|
|
|
|
### Example Usage
|
|
|
|
```java
|
|
package hello.world;
|
|
|
|
import com.clerk.backend_api.Clerk;
|
|
import com.clerk.backend_api.models.components.*;
|
|
import com.clerk.backend_api.models.components.Security;
|
|
import com.clerk.backend_api.models.operations.*;
|
|
import com.clerk.backend_api.utils.EventStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigInteger;
|
|
import java.time.LocalDate;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.Optional;
|
|
import org.openapitools.jackson.nullable.JsonNullable;
|
|
import static java.util.Map.entry;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
Clerk sdk = Clerk.builder()
|
|
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
|
|
.build();
|
|
|
|
GetClientResponse res = sdk.clients().get()
|
|
.clientId("<value>")
|
|
.call();
|
|
|
|
if (res.client().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (com.clerk.backend_api.models.errors.SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
|
| `clientId` | *String* | :heavy_check_mark: | Client ID. |
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.GetClientResponse>](../../models/operations/GetClientResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------- | ------------------------- | ------------------------- |
|
|
| models/errors/ClerkErrors | 400,401,404 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|