diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 9f4ac18..13ece41 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,17 +3,17 @@ id: 1d22a5a4-8bac-42e3-b164-121fcacf66c9 management: docChecksum: 93fd7098475aa331fae95503f8934b72 docVersion: v1 - speakeasyVersion: 1.308.0 - generationVersion: 2.342.2 - releaseVersion: 0.0.6 - configChecksum: cb7ef88f81ef5fcbf329c9c5229575ad + speakeasyVersion: 1.308.1 + generationVersion: 2.342.6 + releaseVersion: 0.0.7 + configChecksum: 9b28dbcdf23f69543c2d231d6602b4ad repoURL: https://github.com/clerk/clerk-sdk-java.git published: true features: java: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.1 - core: 3.23.0 + core: 3.23.2 deprecations: 2.81.1 examples: 2.81.3 flattening: 2.81.1 @@ -187,6 +187,7 @@ generatedFiles: - src/main/java/com/clerk/backend_api/utils/HTTPClient.java - src/main/java/com/clerk/backend_api/utils/HTTPRequest.java - src/main/java/com/clerk/backend_api/utils/HeaderMetadata.java + - src/main/java/com/clerk/backend_api/utils/Helpers.java - src/main/java/com/clerk/backend_api/utils/Hook.java - src/main/java/com/clerk/backend_api/utils/Hooks.java - src/main/java/com/clerk/backend_api/utils/JSON.java diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 84b3177..5069cca 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true java: - version: 0.0.6 + version: 0.0.7 additionalDependencies: [] additionalPlugins: [] artifactID: backend-api diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 42b96b0..edf2d3a 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,8 +1,8 @@ -speakeasyVersion: 1.308.0 +speakeasyVersion: 1.308.1 sources: clerk-java-sdk: sourceNamespace: clerk-java-sdk - sourceRevisionDigest: sha256:d4fd4a5d74493247640d406eb1bbe6fa946106341dc93d8b8647003b7183881a + sourceRevisionDigest: sha256:5e10a06ed81708645c450c8bbac2ac9a99d115ea4929af0d91ecb2f6419d1500 sourceBlobDigest: sha256:be6a2adf86086a55368c73204dfb84b5ca2f9d8514f771aff33857624a212e56 tags: - latest @@ -11,7 +11,7 @@ targets: my-first-target: source: clerk-java-sdk sourceNamespace: clerk-java-sdk - sourceRevisionDigest: sha256:d4fd4a5d74493247640d406eb1bbe6fa946106341dc93d8b8647003b7183881a + sourceRevisionDigest: sha256:5e10a06ed81708645c450c8bbac2ac9a99d115ea4929af0d91ecb2f6419d1500 sourceBlobDigest: sha256:be6a2adf86086a55368c73204dfb84b5ca2f9d8514f771aff33857624a212e56 outLocation: /github/workspace/repo workflow: diff --git a/README.md b/README.md index ef36e43..29b557e 100644 --- a/README.md +++ b/README.md @@ -15,19 +15,21 @@ The Clerk Java library provides convenient access to the Clerk REST API from any ### Getting started +JDK 11 or later is required. + The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.clerk.backend_api:api:0.0.6' +implementation 'com.clerk:backend-api:0.0.7' ``` Maven: ```xml - com.clerk.backend_api - api - 0.0.6 + com.clerk + backend-api + 0.0.7 ``` diff --git a/RELEASES.md b/RELEASES.md index cb5dd3f..693fa5c 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -48,4 +48,14 @@ Based on: ### Generated - [java v0.0.6] . ### Releases -- [Maven Central v0.0.6] https://central.sonatype.com/artifact/com.clerk/backend-api/0.0.6 - . \ No newline at end of file +- [Maven Central v0.0.6] https://central.sonatype.com/artifact/com.clerk/backend-api/0.0.6 - . + +## 2024-06-14 15:08:10 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.308.1 (2.342.6) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v0.0.7] . +### Releases +- [Maven Central v0.0.7] https://central.sonatype.com/artifact/com.clerk/backend-api/0.0.7 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0543535..9921330 100644 --- a/build.gradle +++ b/build.gradle @@ -24,13 +24,13 @@ repositories { // Use Maven Central for resolving dependencies. mavenCentral() } + java { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 withSourcesJar() withJavadocJar() } - model { tasks.generatePomFileForMavenPublication { destination = file("$buildDir/pom.xml") @@ -61,7 +61,7 @@ tasks.withType(Javadoc) { options.addStringOption('Xdoclint:none', '-quiet') } group = "com.clerk" -version = "0.0.6" +version = "0.0.7" sourcesJar { archiveBaseName = "backend-api" @@ -98,7 +98,7 @@ publishing { maven(MavenPublication) { groupId = 'com.clerk' artifactId = 'backend-api' - version = '0.0.6' + version = '0.0.7' from components.java diff --git a/src/main/java/com/clerk/backend_api/SDKConfiguration.java b/src/main/java/com/clerk/backend_api/SDKConfiguration.java index 0547638..0dc93a2 100644 --- a/src/main/java/com/clerk/backend_api/SDKConfiguration.java +++ b/src/main/java/com/clerk/backend_api/SDKConfiguration.java @@ -21,9 +21,9 @@ public Optional securitySource() { public int serverIdx = 0; public String language = "java"; public String openapiDocVersion = "v1"; - public String sdkVersion = "0.0.6"; - public String genVersion = "2.342.2"; - public String userAgent = "speakeasy-sdk/java 0.0.6 2.342.2 v1 com.clerk.backend_api"; + public String sdkVersion = "0.0.7"; + public String genVersion = "2.342.6"; + public String userAgent = "speakeasy-sdk/java 0.0.7 2.342.6 v1 com.clerk.backend_api"; private com.clerk.backend_api.utils.Hooks _hooks = createHooks(); diff --git a/src/main/java/com/clerk/backend_api/utils/BackoffStrategy.java b/src/main/java/com/clerk/backend_api/utils/BackoffStrategy.java index 057b972..ec54e59 100644 --- a/src/main/java/com/clerk/backend_api/utils/BackoffStrategy.java +++ b/src/main/java/com/clerk/backend_api/utils/BackoffStrategy.java @@ -5,7 +5,6 @@ package com.clerk.backend_api.utils; import java.util.concurrent.TimeUnit; -import com.clerk.backend_api.utils.Utils; /** * Exponential Backoff Strategy with Jitter @@ -65,7 +64,7 @@ public double baseFactor() { } /** - * @deprecated use baseFactor instead. + * @deprecated use {@link #baseFactor()} instead. */ @Deprecated public double exponent() { @@ -169,8 +168,8 @@ public Builder baseFactor(double baseFactor) { /** * Sets the backoff base factor. * - * @deprecated use baseFactor instead. - * @param exponent The base factor to use. + * @deprecated use {@link #baseFactor(double)} instead. + * @param baseFactor The base factor to use. * @return The builder instance. */ @Deprecated diff --git a/src/main/java/com/clerk/backend_api/utils/Helpers.java b/src/main/java/com/clerk/backend_api/utils/Helpers.java new file mode 100644 index 0000000..77e1a70 --- /dev/null +++ b/src/main/java/com/clerk/backend_api/utils/Helpers.java @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + */ + +package com.clerk.backend_api.utils; + +import java.net.http.HttpRequest; +import java.util.function.BiPredicate; + +/** + * Public helper methods for use by customers and end-users. + * + */ +public final class Helpers { + + /** + * Returns an {@link HttpRequest.Builder} which is initialized with the + * state of the given {@link HttpRequest}. + * + *

Note that headers can be added and modified but not removed. To + * remove headers use {@link #copy(HttpRequest, BiPredicate)} (which applies + * a filter to the headers while copying). + * + *

Note also that this method is redundant from JDK 16 because the + * method {@code HttpRequest.newBuilder(HttpRequest)} is available. + * + * @param request request to copy + * @return a builder initialized with values from {@code request} + */ + public static HttpRequest.Builder copy(HttpRequest request) { + return Utils.copy(request); + } + + /** + * Returns an {@link HttpRequest.Builder} which is initialized with the + * state of the given {@link HttpRequest}. + * + *

Note that this method is redundant from JDK 16 because the + * method {@code HttpRequest.newBuilder(HttpRequest, BiPredicate)} is available. + + * @param request request to copy + * @param filter selects which header key-values to include in the copied request + * @return a builder initialized with values from {@code request} + */ + public static HttpRequest.Builder copy(HttpRequest request, BiPredicate filter) { + return Utils.copy(request, filter); + } +} diff --git a/src/main/java/com/clerk/backend_api/utils/Hook.java b/src/main/java/com/clerk/backend_api/utils/Hook.java index 0a2de39..17d5ffd 100644 --- a/src/main/java/com/clerk/backend_api/utils/Hook.java +++ b/src/main/java/com/clerk/backend_api/utils/Hook.java @@ -258,7 +258,7 @@ public static final class IdempotencyHook implements BeforeRequest { @Override public HttpRequest beforeRequest(BeforeRequestContext context, HttpRequest request) throws Exception { - HttpRequest.Builder b = Utils.copy(request); + HttpRequest.Builder b = Helpers.copy(request); b.header("Idempotency-Key", UUID.randomUUID().toString()); return b.build(); } diff --git a/src/main/java/com/clerk/backend_api/utils/Utils.java b/src/main/java/com/clerk/backend_api/utils/Utils.java index eb0a7a3..e473311 100644 --- a/src/main/java/com/clerk/backend_api/utils/Utils.java +++ b/src/main/java/com/clerk/backend_api/utils/Utils.java @@ -23,6 +23,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.concurrent.Callable; +import java.util.function.BiPredicate; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -843,6 +844,18 @@ public static boolean statusCodeMatchesOne(int statusCode, String expectedStatus * @return a builder initialized with values from {@code request} */ public static HttpRequest.Builder copy(HttpRequest request) { + return copy(request, (k, v) -> true); + } + + /** + * Returns an {@link HttpRequest.Builder} which is initialized with the + * state of the given {@link HttpRequest}. + * + * @param request request to copy + * @param filter selects which header key-values to include in the copied request + * @return a builder initialized with values from {@code request} + */ + public static HttpRequest.Builder copy(HttpRequest request, BiPredicate filter) { // in JDK 16+ we can use this // return HttpRequest.newBuilder(request, (k, v) -> true); checkNotNull(request, "request"); @@ -851,8 +864,12 @@ public static HttpRequest.Builder copy(HttpRequest request) { builder.uri(request.uri()); builder.expectContinue(request.expectContinue()); - request.headers().map().forEach((name, values) -> - values.forEach(value -> builder.header(name, value))); + request.headers() + .map() + .forEach((name, values) -> + values.stream() + .filter(v -> filter.test(name, v)) + .forEach(value -> builder.header(name, value))); request.version().ifPresent(builder::version); request.timeout().ifPresent(builder::timeout);