mirror of
https://github.com/LukeHagar/clerk-sdk-java.git
synced 2025-12-06 04:19:25 +00:00
351 lines
14 KiB
Markdown
351 lines
14 KiB
Markdown
# JwtTemplates
|
|
(*jwtTemplates()*)
|
|
|
|
### Available Operations
|
|
|
|
* [list](#list) - List all templates
|
|
* [create](#create) - Create a JWT template
|
|
* [get](#get) - Retrieve a template
|
|
* [update](#update) - Update a JWT template
|
|
* [delete](#delete) - Delete a Template
|
|
|
|
## list
|
|
|
|
List all templates
|
|
|
|
### 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();
|
|
|
|
ListJWTTemplatesResponse res = sdk.jwtTemplates().list()
|
|
.call();
|
|
|
|
if (res.jwtTemplateList().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (com.clerk.backend_api.models.errors.SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.ListJWTTemplatesResponse>](../../models/operations/ListJWTTemplatesResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ---------------------- | ---------------------- | ---------------------- |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|
|
|
|
## create
|
|
|
|
Create a new JWT template
|
|
|
|
### 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();
|
|
|
|
CreateJWTTemplateRequestBody req = CreateJWTTemplateRequestBody.builder()
|
|
.build();
|
|
|
|
CreateJWTTemplateResponse res = sdk.jwtTemplates().create()
|
|
.request(req)
|
|
.call();
|
|
|
|
if (res.jwtTemplate().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.CreateJWTTemplateRequestBody](../../models/operations/CreateJWTTemplateRequestBody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.CreateJWTTemplateResponse>](../../models/operations/CreateJWTTemplateResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------- | ------------------------- | ------------------------- |
|
|
| models/errors/ClerkErrors | 400,402,422 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|
|
|
|
## get
|
|
|
|
Retrieve the details of a given JWT template
|
|
|
|
### 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();
|
|
|
|
GetJWTTemplateResponse res = sdk.jwtTemplates().get()
|
|
.templateId("<value>")
|
|
.call();
|
|
|
|
if (res.jwtTemplate().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 |
|
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
|
| `templateId` | *String* | :heavy_check_mark: | JWT Template ID |
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.GetJWTTemplateResponse>](../../models/operations/GetJWTTemplateResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------- | ------------------------- | ------------------------- |
|
|
| models/errors/ClerkErrors | 404 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|
|
|
|
## update
|
|
|
|
Updates an existing JWT template
|
|
|
|
### 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();
|
|
|
|
UpdateJWTTemplateResponse res = sdk.jwtTemplates().update()
|
|
.templateId("<value>")
|
|
.requestBody(UpdateJWTTemplateRequestBody.builder()
|
|
.build())
|
|
.call();
|
|
|
|
if (res.jwtTemplate().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 |
|
|
| --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `templateId` | *String* | :heavy_check_mark: | The ID of the JWT template to update |
|
|
| `requestBody` | [Optional<? extends com.clerk.backend_api.models.operations.UpdateJWTTemplateRequestBody>](../../models/operations/UpdateJWTTemplateRequestBody.md) | :heavy_minus_sign: | N/A |
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.UpdateJWTTemplateResponse>](../../models/operations/UpdateJWTTemplateResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------- | ------------------------- | ------------------------- |
|
|
| models/errors/ClerkErrors | 400,402,422 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|
|
|
|
## delete
|
|
|
|
Delete a Template
|
|
|
|
### 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();
|
|
|
|
DeleteJWTTemplateResponse res = sdk.jwtTemplates().delete()
|
|
.templateId("<value>")
|
|
.call();
|
|
|
|
if (res.deletedObject().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 |
|
|
| ------------------ | ------------------ | ------------------ | ------------------ |
|
|
| `templateId` | *String* | :heavy_check_mark: | JWT Template ID |
|
|
|
|
|
|
### Response
|
|
|
|
**[Optional<? extends com.clerk.backend_api.models.operations.DeleteJWTTemplateResponse>](../../models/operations/DeleteJWTTemplateResponse.md)**
|
|
### Errors
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------- | ------------------------- | ------------------------- |
|
|
| models/errors/ClerkErrors | 403,404 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | */* |
|