Skip to content

Commit 58e5021

Browse files
committed
## Java SDK Changes Detected:
* `clerk.machines.rotateSecretKey()`: **Added** * `clerk.waitlistEntries.delete()`: **Added** * `clerk.commerce.extendSubscriptionItemFreeTrial()`: **Added** * `clerk.commerce.listSubscriptionItems()`: `request` **Changed**
1 parent 336f62e commit 58e5021

File tree

478 files changed

+15657
-12771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

478 files changed

+15657
-12771
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.env
2+
.env.local
13
**/.speakeasy/temp/
24
**/.speakeasy/logs/
35
.speakeasy/reports

.speakeasy/gen.lock

Lines changed: 86 additions & 10 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ generation:
1616
auth:
1717
oAuth2ClientCredentialsEnabled: true
1818
oAuth2PasswordEnabled: false
19+
hoistGlobalSecurity: true
20+
schemas:
21+
allOfMergeStrategy: shallowMerge
1922
tests:
2023
generateTests: true
2124
generateNewTests: false
2225
skipResponseBodyAssertions: false
2326
java:
24-
version: 3.2.0
27+
version: 3.3.0
2528
additionalDependencies: []
2629
additionalPlugins: []
2730
artifactID: backend-api
@@ -31,9 +34,10 @@ java:
3134
companyName: My Company
3235
companyURL: www.mycompany.com
3336
defaultErrorName: SDKError
34-
enableAsync: false
3537
enableCustomCodeRegions: false
38+
enableStreamingUploads: false
3639
flattenGlobalSecurity: true
40+
generateSpringBootStarter: true
3741
githubURL: github.com/owner/repo
3842
groupID: com.clerk
3943
imports:

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
speakeasyVersion: 1.606.9
1+
speakeasyVersion: 1.638.0
22
sources:
33
clerk-java-sdk:
44
sourceNamespace: clerk-java-sdk
5-
sourceRevisionDigest: sha256:50ec69cb208a504bcf1098f28817af6691e8e924eb4349d141989a927680dfe8
6-
sourceBlobDigest: sha256:f8e89b57ae783aa6cc659bdc7c1d7955947b0c989a2224290169d25eb18c65df
5+
sourceRevisionDigest: sha256:8a0bb9b60d98538847fe03fb23a22241be19f7f0bf3ced7c017bf1172723ad99
6+
sourceBlobDigest: sha256:dee56d92678973315fec5204a6f0aaad530965513edfbbc97723f50f669977ab
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1753143080
9+
- speakeasy-sdk-regen-1756771797
1010
- "2025-04-10"
1111
targets:
1212
clerk-java:
1313
source: clerk-java-sdk
1414
sourceNamespace: clerk-java-sdk
15-
sourceRevisionDigest: sha256:50ec69cb208a504bcf1098f28817af6691e8e924eb4349d141989a927680dfe8
16-
sourceBlobDigest: sha256:f8e89b57ae783aa6cc659bdc7c1d7955947b0c989a2224290169d25eb18c65df
15+
sourceRevisionDigest: sha256:8a0bb9b60d98538847fe03fb23a22241be19f7f0bf3ced7c017bf1172723ad99
16+
sourceBlobDigest: sha256:dee56d92678973315fec5204a6f0aaad530965513edfbbc97723f50f669977ab
1717
codeSamplesNamespace: clerk-java-sdk-code-samples
18-
codeSamplesRevisionDigest: sha256:ce2a259ab2e8d16332425f8ffa3e5d352574ad828ec574b02ed47ab8c262a028
18+
codeSamplesRevisionDigest: sha256:7b87ee86f6ab03307f336d56cdda6c99cf06a868f61086a75bd616bbcaf4fab1
1919
my-first-target:
2020
source: clerk-java-sdk
2121
sourceNamespace: clerk-java-sdk

README.md

Lines changed: 173 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ More information about the API can be found at https://clerk.com/docs
3434
* [Retries](#retries)
3535
* [Error Handling](#error-handling)
3636
* [Server Selection](#server-selection)
37+
* [Custom HTTP Client](#custom-http-client)
3738
* [Debugging](#debugging)
3839
* [Development](#development)
3940
* [Contributions](#contributions)
@@ -51,15 +52,15 @@ The samples below show how a published SDK artifact is used:
5152

5253
Gradle:
5354
```groovy
54-
implementation 'com.clerk:backend-api:3.2.0'
55+
implementation 'com.clerk:backend-api:3.3.0'
5556
```
5657

5758
Maven:
5859
```xml
5960
<dependency>
6061
<groupId>com.clerk</groupId>
6162
<artifactId>backend-api</artifactId>
62-
<version>3.2.0</version>
63+
<version>3.3.0</version>
6364
</dependency>
6465
```
6566

@@ -226,7 +227,6 @@ public class MachineAuthentication {
226227
* [create](docs/sdks/blocklistidentifiers/README.md#create) - Add identifier to the block-list
227228
* [delete](docs/sdks/blocklistidentifiers/README.md#delete) - Delete identifier from block-list
228229

229-
230230
### [clients()](docs/sdks/clients/README.md)
231231

232232
* [~~list~~](docs/sdks/clients/README.md#list) - List all clients :warning: **Deprecated**
@@ -238,6 +238,7 @@ public class MachineAuthentication {
238238
* [listPlans](docs/sdks/commerce/README.md#listplans) - List all commerce plans
239239
* [listSubscriptionItems](docs/sdks/commerce/README.md#listsubscriptionitems) - List all subscription items
240240
* [cancelSubscriptionItem](docs/sdks/commerce/README.md#cancelsubscriptionitem) - Cancel a subscription item
241+
* [extendSubscriptionItemFreeTrial](docs/sdks/commerce/README.md#extendsubscriptionitemfreetrial) - Extend free trial for a subscription item
241242

242243
### [domains()](docs/sdks/domains/README.md)
243244

@@ -311,6 +312,7 @@ public class MachineAuthentication {
311312
* [update](docs/sdks/machines/README.md#update) - Update a machine
312313
* [delete](docs/sdks/machines/README.md#delete) - Delete a machine
313314
* [getSecretKey](docs/sdks/machines/README.md#getsecretkey) - Retrieve a machine secret key
315+
* [rotateSecretKey](docs/sdks/machines/README.md#rotatesecretkey) - Rotate a machine's secret key
314316
* [createScope](docs/sdks/machines/README.md#createscope) - Create a machine scope
315317
* [deleteScope](docs/sdks/machines/README.md#deletescope) - Delete a machine scope
316318
@@ -458,6 +460,7 @@ public class MachineAuthentication {
458460

459461
* [list](docs/sdks/waitlistentries/README.md#list) - List all waitlist entries
460462
* [create](docs/sdks/waitlistentries/README.md#create) - Create a waitlist entry
463+
* [delete](docs/sdks/waitlistentries/README.md#delete) - Delete a pending waitlist entry
461464
* [invite](docs/sdks/waitlistentries/README.md#invite) - Invite a waitlist entry
462465
* [reject](docs/sdks/waitlistentries/README.md#reject) - Reject a waitlist entry
463466

@@ -553,15 +556,19 @@ public class Application {
553556
554557
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
555558
556-
By default, an API error will throw a `models/errors/SDKError` exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `delete` method throws the following exceptions:
557559
558-
| Error Type | Status Code | Content Type |
559-
| ------------------------- | ------------------ | ---------------- |
560-
| models/errors/ClerkErrors | 400, 401, 403, 404 | application/json |
561-
| models/errors/SDKError | 4XX, 5XX | \*/\* |
560+
[`ClerkError`](./src/main/java/models/errors/ClerkError.java) is the base class for all HTTP error responses. It has the following properties:
562561
563-
### Example
562+
| Method | Type | Description |
563+
| ---------------- | --------------------------- | ------------------------------------------------------------------------ |
564+
| `message()` | `String` | Error message |
565+
| `code()` | `int` | HTTP response status code eg `404` |
566+
| `headers` | `Map<String, List<String>>` | HTTP response headers |
567+
| `body()` | `byte[]` | HTTP body as a byte array. Can be empty array if no body is returned. |
568+
| `bodyAsString()` | `String` | HTTP body as a UTF-8 string. Can be empty string if no body is returned. |
569+
| `rawResponse()` | `HttpResponse<?>` | Raw HTTP response (body already read and not available for re-read) |
564570
571+
### Example
565572
```java
566573
package hello.world;
567574
@@ -588,6 +595,38 @@ public class Application {
588595
}
589596
}
590597
```
598+
599+
### Error Classes
600+
**Primary errors:**
601+
* [`ClerkError`](./src/main/java/models/errors/ClerkError.java): The base class for HTTP error responses.
602+
* [`com.clerk.backend_api.models.errors.ClerkErrors`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.ClerkErrors.java): Request was not successful. *
603+
604+
<details><summary>Less common errors (17)</summary>
605+
606+
<br />
607+
608+
**Network errors:**
609+
* `java.io.IOException` (always wrapped by `java.io.UncheckedIOException`). Commonly encountered subclasses of
610+
`IOException` include `java.net.ConnectException`, `java.net.SocketTimeoutException`, `EOFException` (there are
611+
many more subclasses in the JDK platform).
612+
613+
**Inherit from [`ClerkError`](./src/main/java/models/errors/ClerkError.java)**:
614+
* [`com.clerk.backend_api.models.errors.CreateM2MTokenResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.CreateM2MTokenResponseBody.java): 400 Bad Request. Status code `400`. Applicable to 1 of 159 methods.*
615+
* [`com.clerk.backend_api.models.errors.GetM2MTokensResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.GetM2MTokensResponseBody.java): 400 Bad Request. Status code `400`. Applicable to 1 of 159 methods.*
616+
* [`com.clerk.backend_api.models.errors.RevokeM2MTokenResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.RevokeM2MTokenResponseBody.java): 400 Bad Request. Status code `400`. Applicable to 1 of 159 methods.*
617+
* [`com.clerk.backend_api.models.errors.VerifyM2MTokenResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.VerifyM2MTokenResponseBody.java): 400 Bad Request. Status code `400`. Applicable to 1 of 159 methods.*
618+
* [`com.clerk.backend_api.models.errors.VerifyOAuthAccessTokenResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.VerifyOAuthAccessTokenResponseBody.java): 400 Bad Request. Status code `400`. Applicable to 1 of 159 methods.*
619+
* [`com.clerk.backend_api.models.errors.GetM2MTokensM2mResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.GetM2MTokensM2mResponseBody.java): 403 Forbidden. Status code `403`. Applicable to 1 of 159 methods.*
620+
* [`com.clerk.backend_api.models.errors.GetM2MTokensM2mResponseResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.GetM2MTokensM2mResponseResponseBody.java): 404 Not Found. Status code `404`. Applicable to 1 of 159 methods.*
621+
* [`com.clerk.backend_api.models.errors.RevokeM2MTokenM2mResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.RevokeM2MTokenM2mResponseBody.java): 404 Not Found. Status code `404`. Applicable to 1 of 159 methods.*
622+
* [`com.clerk.backend_api.models.errors.VerifyM2MTokenM2mResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.VerifyM2MTokenM2mResponseBody.java): 404 Not Found. Status code `404`. Applicable to 1 of 159 methods.*
623+
* [`com.clerk.backend_api.models.errors.VerifyOAuthAccessTokenOauthAccessTokensResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.VerifyOAuthAccessTokenOauthAccessTokensResponseBody.java): 404 Not Found. Status code `404`. Applicable to 1 of 159 methods.*
624+
* [`com.clerk.backend_api.models.errors.CreateM2MTokenM2mResponseBody`](./src/main/java/models/errors/com.clerk.backend_api.models.errors.CreateM2MTokenM2mResponseBody.java): 409 Conflict. Status code `409`. Applicable to 1 of 159 methods.*
625+
626+
627+
</details>
628+
629+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
591630
<!-- End Error Handling [errors] -->
592631
593632
<!-- Start Server Selection [server] -->
@@ -621,6 +660,131 @@ public class Application {
621660
<!-- End Server Selection [server] -->
622661
623662
663+
<!-- Start Custom HTTP Client [http-client] -->
664+
## Custom HTTP Client
665+
666+
The Java SDK makes API calls using an `HTTPClient` that wraps the native
667+
[HttpClient](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html). This
668+
client provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle
669+
errors and response.
670+
671+
The `HTTPClient` interface allows you to either use the default `SpeakeasyHTTPClient` that comes with the SDK,
672+
or provide your own custom implementation with customized configuration such as custom executors, SSL context,
673+
connection pools, and other HTTP client settings.
674+
675+
The interface provides synchronous (`send`) methods.
676+
677+
The following example shows how to add a custom header and handle errors:
678+
679+
```java
680+
import com.clerk.backend_api.Clerk;
681+
import com.clerk.backend_api.utils.HTTPClient;
682+
import com.clerk.backend_api.utils.SpeakeasyHTTPClient;
683+
import com.clerk.backend_api.utils.Utils;
684+
685+
import java.io.IOException;
686+
import java.net.URISyntaxException;
687+
import java.net.http.HttpRequest;
688+
import java.net.http.HttpResponse;
689+
import java.io.InputStream;
690+
import java.time.Duration;
691+
692+
public class Application {
693+
public static void main(String[] args) {
694+
// Create a custom HTTP client with hooks
695+
HTTPClient httpClient = new HTTPClient() {
696+
private final HTTPClient defaultClient = new SpeakeasyHTTPClient();
697+
698+
@Override
699+
public HttpResponse<InputStream> send(HttpRequest request) throws IOException, URISyntaxException, InterruptedException {
700+
// Add custom header and timeout using Utils.copy()
701+
HttpRequest modifiedRequest = Utils.copy(request)
702+
.header("x-custom-header", "custom value")
703+
.timeout(Duration.ofSeconds(30))
704+
.build();
705+
706+
try {
707+
HttpResponse<InputStream> response = defaultClient.send(modifiedRequest);
708+
// Log successful response
709+
System.out.println("Request successful: " + response.statusCode());
710+
return response;
711+
} catch (Exception error) {
712+
// Log error
713+
System.err.println("Request failed: " + error.getMessage());
714+
throw error;
715+
}
716+
}
717+
};
718+
719+
Clerk sdk = Clerk.builder()
720+
.client(httpClient)
721+
.build();
722+
}
723+
}
724+
```
725+
726+
<details>
727+
<summary>Custom HTTP Client Configuration</summary>
728+
729+
You can also provide a completely custom HTTP client with your own configuration:
730+
731+
```java
732+
import com.clerk.backend_api.Clerk;
733+
import com.clerk.backend_api.utils.HTTPClient;
734+
735+
import java.io.IOException;
736+
import java.net.URISyntaxException;
737+
import java.net.http.HttpClient;
738+
import java.net.http.HttpRequest;
739+
import java.net.http.HttpResponse;
740+
import java.io.InputStream;
741+
import java.time.Duration;
742+
import java.util.concurrent.Executors;
743+
744+
public class Application {
745+
public static void main(String[] args) {
746+
// Custom HTTP client with custom configuration
747+
HTTPClient customHttpClient = new HTTPClient() {
748+
private final HttpClient client = HttpClient.newBuilder()
749+
.executor(Executors.newFixedThreadPool(10))
750+
.connectTimeout(Duration.ofSeconds(30))
751+
// .sslContext(customSslContext) // Add custom SSL context if needed
752+
.build();
753+
754+
@Override
755+
public HttpResponse<InputStream> send(HttpRequest request) throws IOException, URISyntaxException, InterruptedException {
756+
return client.send(request, HttpResponse.BodyHandlers.ofInputStream());
757+
}
758+
};
759+
760+
Clerk sdk = Clerk.builder()
761+
.client(customHttpClient)
762+
.build();
763+
}
764+
}
765+
```
766+
767+
</details>
768+
769+
You can also enable debug logging on the default `SpeakeasyHTTPClient`:
770+
771+
```java
772+
import com.clerk.backend_api.Clerk;
773+
import com.clerk.backend_api.utils.SpeakeasyHTTPClient;
774+
775+
public class Application {
776+
public static void main(String[] args) {
777+
SpeakeasyHTTPClient httpClient = new SpeakeasyHTTPClient();
778+
httpClient.enableDebugLogging(true);
779+
780+
Clerk sdk = Clerk.builder()
781+
.client(httpClient)
782+
.build();
783+
}
784+
}
785+
```
786+
<!-- End Custom HTTP Client [http-client] -->
787+
624788
<!-- Start Debugging [debug] -->
625789
## Debugging
626790

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,14 @@ Based on:
348348
### Generated
349349
- [java v3.2.0] .
350350
### Releases
351-
- [Maven Central v3.2.0] https://central.sonatype.com/artifact/com.clerk/backend-api/3.2.0 - .
351+
- [Maven Central v3.2.0] https://central.sonatype.com/artifact/com.clerk/backend-api/3.2.0 - .
352+
353+
## 2025-10-22 00:10:09
354+
### Changes
355+
Based on:
356+
- OpenAPI Doc
357+
- Speakeasy CLI 1.638.0 (2.728.0) https://github.com/speakeasy-api/speakeasy
358+
### Generated
359+
- [java v3.3.0] .
360+
### Releases
361+
- [Maven Central v3.3.0] https://central.sonatype.com/artifact/com.clerk/backend-api/3.3.0 - .

0 commit comments

Comments
 (0)