Skip to content

Commit

Permalink
Merge pull request #9 from clerk/speakeasy-sdk-regen-1718377693
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate
  • Loading branch information
kylemac authored Jun 14, 2024
2 parents 5a97ead + e35b2f7 commit 67987e4
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 27 deletions.
11 changes: 6 additions & 5 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
java:
version: 0.0.6
version: 0.0.7
additionalDependencies: []
additionalPlugins: []
artifactID: backend-api
Expand Down
6 changes: 3 additions & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<dependency>
<groupId>com.clerk.backend_api</groupId>
<artifactId>api</artifactId>
<version>0.0.6</version>
<groupId>com.clerk</groupId>
<artifactId>backend-api</artifactId>
<version>0.0.7</version>
</dependency>
```

Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - .
- [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 - .
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -98,7 +98,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.clerk'
artifactId = 'backend-api'
version = '0.0.6'
version = '0.0.7'

from components.java

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/clerk/backend_api/SDKConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public Optional<SecuritySource> 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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -65,7 +64,7 @@ public double baseFactor() {
}

/**
* @deprecated use baseFactor instead.
* @deprecated use {@link #baseFactor()} instead.
*/
@Deprecated
public double exponent() {
Expand Down Expand Up @@ -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
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/com/clerk/backend_api/utils/Helpers.java
Original file line number Diff line number Diff line change
@@ -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}.
*
* <p>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).
*
* <p>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}.
*
* <p>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<String, String> filter) {
return Utils.copy(request, filter);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/clerk/backend_api/utils/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
21 changes: 19 additions & 2 deletions src/main/java/com/clerk/backend_api/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, String> filter) {
// in JDK 16+ we can use this
// return HttpRequest.newBuilder(request, (k, v) -> true);
checkNotNull(request, "request");
Expand All @@ -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);
Expand Down

0 comments on commit 67987e4

Please sign in to comment.