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);