diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock
index 546f031..b79f2e8 100755
--- a/.speakeasy/gen.lock
+++ b/.speakeasy/gen.lock
@@ -1,12 +1,14 @@
lockVersion: 2.0.0
id: 1d22a5a4-8bac-42e3-b164-121fcacf66c9
management:
- docChecksum: c4aa5fe08445d9bd9cce938a8e22a9bd
+ docChecksum: 93fd7098475aa331fae95503f8934b72
docVersion: v1
- speakeasyVersion: 1.307.1
+ speakeasyVersion: 1.307.2
generationVersion: 2.342.2
- releaseVersion: 0.0.1
- configChecksum: ded0598933a8d75e7def29ab016062a4
+ releaseVersion: 0.0.2
+ configChecksum: cbacb66c514142b06e6d37a52d129dfe
+ repoURL: https://github.com/clerk/clerk-sdk-java.git
+ published: true
features:
java:
additionalDependencies: 0.1.0
diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml
index 80f54c9..8c9397a 100755
--- a/.speakeasy/gen.yaml
+++ b/.speakeasy/gen.yaml
@@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
java:
- version: 0.0.1
+ version: 0.0.2
additionalDependencies: []
additionalPlugins: []
artifactID: backend-api
diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock
index 378afd0..391c282 100644
--- a/.speakeasy/workflow.lock
+++ b/.speakeasy/workflow.lock
@@ -1,27 +1,35 @@
-speakeasyVersion: 1.307.1
+speakeasyVersion: 1.307.2
sources:
clerk-java-sdk:
sourceNamespace: clerk-java-sdk
- sourceRevisionDigest: sha256:671a76348ffa42f50e48f36d00117419df09deedf8c407f5998533e01a8b64cb
- sourceBlobDigest: sha256:e23b66a7b10f867245e42a1cd46af66f9ebee2db346f6a3bfcec0aa79ae2ac86
+ sourceRevisionDigest: sha256:9e02ef8a222cb78445ec7a7ac7bd777d669a4fddfe0467cdad28aa02fd69c2fb
+ sourceBlobDigest: sha256:be6a2adf86086a55368c73204dfb84b5ca2f9d8514f771aff33857624a212e56
tags:
- latest
+ - main
targets:
my-first-target:
source: clerk-java-sdk
sourceNamespace: clerk-java-sdk
- sourceRevisionDigest: sha256:671a76348ffa42f50e48f36d00117419df09deedf8c407f5998533e01a8b64cb
- sourceBlobDigest: sha256:e23b66a7b10f867245e42a1cd46af66f9ebee2db346f6a3bfcec0aa79ae2ac86
- outLocation: /Users/kylemac/Sites/clerk/java-sdk/~/Sites/clerk/java-sdk
+ sourceRevisionDigest: sha256:9e02ef8a222cb78445ec7a7ac7bd777d669a4fddfe0467cdad28aa02fd69c2fb
+ sourceBlobDigest: sha256:be6a2adf86086a55368c73204dfb84b5ca2f9d8514f771aff33857624a212e56
+ outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0
+ speakeasyVersion: latest
sources:
clerk-java-sdk:
inputs:
- - location: ../../../../openapi.yml
+ - location: ./openapi.yml
registry:
location: registry.speakeasyapi.dev/clerk/clerk/clerk-java-sdk
targets:
my-first-target:
target: java
source: clerk-java-sdk
+ publish:
+ java:
+ ossrhUsername: clerk
+ ossrhPassword: $ossrh_password
+ gpgSecretKey: $gpg_secret_key
+ gpgPassPhrase: $gpg_pass_phrase
diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml
index 6543d29..1695301 100644
--- a/.speakeasy/workflow.yaml
+++ b/.speakeasy/workflow.yaml
@@ -1,4 +1,5 @@
workflowVersion: 1.0.0
+speakeasyVersion: latest
sources:
clerk-java-sdk:
inputs:
diff --git a/README.md b/README.md
index ce4612e..4da27dc 100644
--- a/README.md
+++ b/README.md
@@ -26,15 +26,15 @@ The samples below show how a published SDK artifact is used:
Gradle:
```groovy
-implementation 'com.clerk.backend_api:openapi:0.0.1'
+implementation 'com.clerk.backend_api:api:0.0.2'
```
Maven:
```xml
com.clerk.backend_api
- openapi
- 0.0.1
+ api
+ 0.0.2
```
diff --git a/RELEASES.md b/RELEASES.md
new file mode 100644
index 0000000..5ceabd2
--- /dev/null
+++ b/RELEASES.md
@@ -0,0 +1,11 @@
+
+
+## 2024-06-13 22:05:28
+### Changes
+Based on:
+- OpenAPI Doc
+- Speakeasy CLI 1.307.2 (2.342.2) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [java v0.0.2] .
+### Releases
+- [Maven Central v0.0.2] https://central.sonatype.com/artifact/com.clerk/backend-api/0.0.2 - .
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index b0213b4..8199a00 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,6 +11,9 @@
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
+ id 'maven-publish'
+ id 'signing'
+ id 'cl.franciscosolis.sonatype-central-upload' version '1.0.0'
}
compileJava.options.encoding = "UTF-8"
@@ -21,11 +24,122 @@ 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")
+ }
+}
+
+jar {
+ dependsOn(":generatePomFileForMavenPublication")
+ archiveBaseName = "backend-api"
+
+ into("META-INF/maven/com.clerk/backend-api") {
+ from("$buildDir/pom.xml")
+ }
+}
+
+javadoc {
+ options.encoding = "UTF-8"
+
+ if(JavaVersion.current().isJava9Compatible()) {
+ options.addBooleanOption('html5', true)
+ }
+ options.addStringOption('Xdoclint:none', '-quiet')
+}
+
tasks.withType(Javadoc) {
failOnError false
options.addStringOption('Xdoclint:none', '-quiet')
}
+group = "com.clerk"
+version = "0.0.2"
+
+sourcesJar {
+ archiveBaseName = "backend-api"
+}
+
+javadocJar {
+ archiveBaseName = "backend-api"
+}
+
+sonatypeCentralUpload {
+ // This is your Sonatype generated username
+ username = System.getenv("SONATYPE_USERNAME")
+ // This is your sonatype generated password
+ password = System.getenv("SONATYPE_PASSWORD")
+
+ // This is a list of files to upload. Ideally you would point to your jar file, source and javadoc jar (required by central)
+ archives = files(
+ "$buildDir/libs/backend-api-${version}.jar",
+ "$buildDir/libs/backend-api-${version}-sources.jar",
+ "$buildDir/libs/backend-api-${version}-javadoc.jar"
+ )
+
+ // This is the pom file to upload. This is required by central
+ pom = file("$buildDir/pom.xml")
+
+ // This is your PGP private key. This is required to sign your files
+ signingKey = System.getenv("SONATYPE_SIGNING_KEY")
+ // This is your PGP private key passphrase to decrypt your private key
+ signingKeyPassphrase = System.getenv("SIGNING_KEY_PASSPHRASE")
+}
+publishing {
+
+ publications {
+ maven(MavenPublication) {
+ groupId = 'com.clerk'
+ artifactId = 'backend-api'
+ version = '0.0.2'
+
+ from components.java
+
+ pom {
+ name = 'My Company Java SDK'
+ description = 'SDK enabling Java developers to easily integrate with the My Company API.'
+ url = 'https://github.com/owner/repo'
+ scm {
+ url = 'github.com/owner/repo'
+ connection = 'scm:git:ssh://git@github.com/owner/repo.git'
+ }
+ licenses {
+ license {
+ name = 'The MIT License (MIT)'
+ url = 'https://mit-license.org/'
+ }
+ }
+ developers {
+ developer {
+ name = 'My Company'
+ organization = 'My Company'
+ email = 'info@mycompany.com'
+ }
+ }
+ organization {
+ name = 'My Company'
+ url = 'www.mycompany.com'
+ }
+ }
+ }
+ }
+}
+
+if (!project.hasProperty('skip.signing')) {
+ signing {
+ def signingKey = findProperty("signingKey")
+ def signingPassphrase = findProperty("signingPassphrase")
+ useInMemoryPgpKeys(signingKey, signingPassphrase)
+ sign publishing.publications.maven
+ }
+}
dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0'
diff --git a/docs/sdks/organizations/README.md b/docs/sdks/organizations/README.md
index 00818d8..001d682 100644
--- a/docs/sdks/organizations/README.md
+++ b/docs/sdks/organizations/README.md
@@ -53,16 +53,8 @@ public class Application {
.request(req)
.call();
- while (true) {
- if (res.organizations().isPresent()) {
- // handle response
- Optional nextRes = res.next();
- if (nextRes.isPresent()) {
- res = nextRes.get();
- } else {
- break;
- }
- }
+ if (res.organizations().isPresent()) {
+ // handle response
}
} catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
// handle exception
diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md
index ca1c135..a9e718a 100644
--- a/docs/sdks/sessions/README.md
+++ b/docs/sdks/sessions/README.md
@@ -50,16 +50,8 @@ public class Application {
.request(req)
.call();
- while (true) {
- if (res.sessionList().isPresent()) {
- // handle response
- Optional nextRes = res.next();
- if (nextRes.isPresent()) {
- res = nextRes.get();
- } else {
- break;
- }
- }
+ if (res.sessionList().isPresent()) {
+ // handle response
}
} catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
// handle exception
diff --git a/docs/sdks/users/README.md b/docs/sdks/users/README.md
index cd7e1c1..a8153a6 100644
--- a/docs/sdks/users/README.md
+++ b/docs/sdks/users/README.md
@@ -62,16 +62,8 @@ public class Application {
.request(req)
.call();
- while (true) {
- if (res.userList().isPresent()) {
- // handle response
- Optional nextRes = res.next();
- if (nextRes.isPresent()) {
- res = nextRes.get();
- } else {
- break;
- }
- }
+ if (res.userList().isPresent()) {
+ // handle response
}
} catch (com.clerk.backend_api.models.errors.ClerkErrors e) {
// handle exception
diff --git a/gradlew.bat b/gradlew.bat
index 93e3f59..6689b85 100755
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,92 +1,92 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%"=="" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%"=="" set DIRNAME=.
-@rem This is normally unused
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if %ERRORLEVEL% equ 0 goto execute
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-if %ERRORLEVEL% equ 0 goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-set EXIT_CODE=%ERRORLEVEL%
-if %EXIT_CODE% equ 0 set EXIT_CODE=1
-if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
-exit /b %EXIT_CODE%
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
index 12ff7d3..93d779e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,4 +7,4 @@
* in the user manual at https://docs.gradle.org/7.5.1/userguide/multi_project_builds.html
*/
-rootProject.name = 'openapi'
+rootProject.name = 'backend-api'
diff --git a/src/main/java/com/clerk/backend_api/Organizations.java b/src/main/java/com/clerk/backend_api/Organizations.java
index 0c39e33..b490b79 100644
--- a/src/main/java/com/clerk/backend_api/Organizations.java
+++ b/src/main/java/com/clerk/backend_api/Organizations.java
@@ -17,16 +17,12 @@
import com.clerk.backend_api.utils.Utils;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.jayway.jsonpath.JsonPath;
-import com.jayway.jsonpath.ReadContext;
import java.io.InputStream;
-import java.lang.Long;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
-import java.util.List;
import java.util.Optional;
import org.apache.http.NameValuePair;
import org.openapitools.jackson.nullable.JsonNullable;
@@ -121,51 +117,19 @@ public com.clerk.backend_api.models.operations.ListOrganizationsResponse list(
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
- byte[] _fullResponse = Utils.toByteArrayAndClose(_httpRes.body());
-
- @SuppressWarnings("deprecation")
com.clerk.backend_api.models.operations.ListOrganizationsResponse.Builder _resBuilder =
com.clerk.backend_api.models.operations.ListOrganizationsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
- .rawResponse(_httpRes)
- .next(() -> {
- String _stringBody = new String(_fullResponse, StandardCharsets.UTF_8);
- ReadContext _body = JsonPath.parse(_stringBody);
-
- if (request == null) {
- return Optional.empty();
- }
- long _requestOffset = request.offset().get();
- @SuppressWarnings("unchecked")
- List _firstResult = _body.read("$", List.class);
- if (_firstResult == null || _firstResult.isEmpty()){
- return Optional.empty();
- };
- long _resolvedLimit = limit.get();
-
- if (_firstResult.size() < _resolvedLimit) {
- return Optional.empty();
- };
- long _newOffset = _requestOffset + _firstResult.size();
- com.clerk.backend_api.models.operations.ListOrganizationsRequestBuilder _ret = list();
- _ret.request(new com.clerk.backend_api.models.operations.ListOrganizationsRequest(
- request.limit(),
- request.offset(),
- request.includeMembersCount(),
- request.query(),
- request.orderBy()
- ));
- return Optional.of(_ret.call());
- });
+ .rawResponse(_httpRes);
com.clerk.backend_api.models.operations.ListOrganizationsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
com.clerk.backend_api.models.components.Organizations _out = Utils.mapper().readValue(
- new String(_fullResponse, StandardCharsets.UTF_8),
+ Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference() {});
_res.withOrganizations(java.util.Optional.ofNullable(_out));
return _res;
@@ -174,13 +138,13 @@ public com.clerk.backend_api.models.operations.ListOrganizationsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "403", "422")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
com.clerk.backend_api.models.errors.ClerkErrors _out = Utils.mapper().readValue(
- new String(_fullResponse, StandardCharsets.UTF_8),
+ Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference() {});
throw _out;
} else {
@@ -188,7 +152,7 @@ public com.clerk.backend_api.models.operations.ListOrganizationsResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) {
@@ -197,13 +161,13 @@ public com.clerk.backend_api.models.operations.ListOrganizationsResponse list(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
diff --git a/src/main/java/com/clerk/backend_api/SDKConfiguration.java b/src/main/java/com/clerk/backend_api/SDKConfiguration.java
index b612fbe..e43ac75 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.1";
+ public String sdkVersion = "0.0.2";
public String genVersion = "2.342.2";
- public String userAgent = "speakeasy-sdk/java 0.0.1 2.342.2 v1 com.clerk.backend_api";
+ public String userAgent = "speakeasy-sdk/java 0.0.2 2.342.2 v1 com.clerk.backend_api";
private com.clerk.backend_api.utils.Hooks _hooks = createHooks();
diff --git a/src/main/java/com/clerk/backend_api/Sessions.java b/src/main/java/com/clerk/backend_api/Sessions.java
index 0285be4..fdab827 100644
--- a/src/main/java/com/clerk/backend_api/Sessions.java
+++ b/src/main/java/com/clerk/backend_api/Sessions.java
@@ -17,16 +17,12 @@
import com.clerk.backend_api.utils.Utils;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.jayway.jsonpath.JsonPath;
-import com.jayway.jsonpath.ReadContext;
import java.io.InputStream;
-import java.lang.Long;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
-import java.util.List;
import java.util.Optional;
import org.apache.http.NameValuePair;
import org.openapitools.jackson.nullable.JsonNullable;
@@ -118,51 +114,19 @@ public com.clerk.backend_api.models.operations.GetSessionListResponse list(
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
- byte[] _fullResponse = Utils.toByteArrayAndClose(_httpRes.body());
-
- @SuppressWarnings("deprecation")
com.clerk.backend_api.models.operations.GetSessionListResponse.Builder _resBuilder =
com.clerk.backend_api.models.operations.GetSessionListResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
- .rawResponse(_httpRes)
- .next(() -> {
- String _stringBody = new String(_fullResponse, StandardCharsets.UTF_8);
- ReadContext _body = JsonPath.parse(_stringBody);
-
- if (request == null) {
- return Optional.empty();
- }
- long _requestOffset = request.offset().get();
- @SuppressWarnings("unchecked")
- List _firstResult = _body.read("$", List.class);
- if (_firstResult == null || _firstResult.isEmpty()){
- return Optional.empty();
- };
- long _resolvedLimit = limit.get();
-
- if (_firstResult.size() < _resolvedLimit) {
- return Optional.empty();
- };
- long _newOffset = _requestOffset + _firstResult.size();
- com.clerk.backend_api.models.operations.GetSessionListRequestBuilder _ret = list();
- _ret.request(new com.clerk.backend_api.models.operations.GetSessionListRequest(
- request.clientId(),
- request.userId(),
- request.status(),
- request.limit(),
- request.offset()
- ));
- return Optional.of(_ret.call());
- });
+ .rawResponse(_httpRes);
com.clerk.backend_api.models.operations.GetSessionListResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
java.util.List _out = Utils.mapper().readValue(
- new String(_fullResponse, StandardCharsets.UTF_8),
+ Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference>() {});
_res.withSessionList(java.util.Optional.ofNullable(_out));
return _res;
@@ -171,13 +135,13 @@ public com.clerk.backend_api.models.operations.GetSessionListResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "422")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
com.clerk.backend_api.models.errors.ClerkErrors _out = Utils.mapper().readValue(
- new String(_fullResponse, StandardCharsets.UTF_8),
+ Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference() {});
throw _out;
} else {
@@ -185,7 +149,7 @@ public com.clerk.backend_api.models.operations.GetSessionListResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) {
@@ -194,13 +158,13 @@ public com.clerk.backend_api.models.operations.GetSessionListResponse list(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
diff --git a/src/main/java/com/clerk/backend_api/Users.java b/src/main/java/com/clerk/backend_api/Users.java
index e65d8bd..da10d37 100644
--- a/src/main/java/com/clerk/backend_api/Users.java
+++ b/src/main/java/com/clerk/backend_api/Users.java
@@ -127,58 +127,19 @@ public com.clerk.backend_api.models.operations.GetUserListResponse list(
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
- byte[] _fullResponse = Utils.toByteArrayAndClose(_httpRes.body());
-
- @SuppressWarnings("deprecation")
com.clerk.backend_api.models.operations.GetUserListResponse.Builder _resBuilder =
com.clerk.backend_api.models.operations.GetUserListResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
- .rawResponse(_httpRes)
- .next(() -> {
- String _stringBody = new String(_fullResponse, StandardCharsets.UTF_8);
- ReadContext _body = JsonPath.parse(_stringBody);
-
- if (request == null) {
- return Optional.empty();
- }
- long _requestOffset = request.offset().get();
- @SuppressWarnings("unchecked")
- List _firstResult = _body.read("$", List.class);
- if (_firstResult == null || _firstResult.isEmpty()){
- return Optional.empty();
- };
- long _resolvedLimit = limit.get();
-
- if (_firstResult.size() < _resolvedLimit) {
- return Optional.empty();
- };
- long _newOffset = _requestOffset + _firstResult.size();
- com.clerk.backend_api.models.operations.GetUserListRequestBuilder _ret = list();
- _ret.request(new com.clerk.backend_api.models.operations.GetUserListRequest(
- request.emailAddress(),
- request.phoneNumber(),
- request.externalId(),
- request.username(),
- request.web3Wallet(),
- request.userId(),
- request.organizationId(),
- request.query(),
- request.lastActiveAtSince(),
- request.limit(),
- request.offset(),
- request.orderBy()
- ));
- return Optional.of(_ret.call());
- });
+ .rawResponse(_httpRes);
com.clerk.backend_api.models.operations.GetUserListResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
java.util.List _out = Utils.mapper().readValue(
- new String(_fullResponse, StandardCharsets.UTF_8),
+ Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference>() {});
_res.withUserList(java.util.Optional.ofNullable(_out));
return _res;
@@ -187,13 +148,13 @@ public com.clerk.backend_api.models.operations.GetUserListResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "422")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
com.clerk.backend_api.models.errors.ClerkErrors _out = Utils.mapper().readValue(
- new String(_fullResponse, StandardCharsets.UTF_8),
+ Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference() {});
throw _out;
} else {
@@ -201,7 +162,7 @@ public com.clerk.backend_api.models.operations.GetUserListResponse list(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) {
@@ -210,13 +171,13 @@ public com.clerk.backend_api.models.operations.GetUserListResponse list(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
- _fullResponse);
+ Utils.toByteArrayAndClose(_httpRes.body()));
}
diff --git a/src/main/java/com/clerk/backend_api/models/operations/GetSessionListRequestBuilder.java b/src/main/java/com/clerk/backend_api/models/operations/GetSessionListRequestBuilder.java
index 9695e0b..ea0e886 100644
--- a/src/main/java/com/clerk/backend_api/models/operations/GetSessionListRequestBuilder.java
+++ b/src/main/java/com/clerk/backend_api/models/operations/GetSessionListRequestBuilder.java
@@ -37,25 +37,4 @@ public GetSessionListResponse call() throws Exception {
return sdk.list(
request);
}
-
- /**
- * Returns a stream that performs next page calls till no more pages
- * are returned. Unlike the {@link #call()} method this method will
- * throw an {@link SDKError} if any page retrieval has an HTTP status
- * code >= 300 (Note that 3XX is not an error range but will need
- * special handling by the user if for example the HTTP client is
- * not configured to follow redirects).
- *
- * @throws {@link SDKError} if HTTP status code >= 300 is encountered
- **/
- public Stream callAsStream() {
- return Utils.stream(() -> Optional.of(call()), x -> {
- if (x.statusCode() >= 300) {
- byte[] body = Utils.toByteArrayAndClose(x.rawResponse().body());
- throw new SDKError(x.rawResponse(), x.statusCode(), x.contentType(), body);
- } else {
- return x.next();
- }
- });
- }
}
diff --git a/src/main/java/com/clerk/backend_api/models/operations/GetSessionListResponse.java b/src/main/java/com/clerk/backend_api/models/operations/GetSessionListResponse.java
index 2feb5d6..8de100f 100644
--- a/src/main/java/com/clerk/backend_api/models/operations/GetSessionListResponse.java
+++ b/src/main/java/com/clerk/backend_api/models/operations/GetSessionListResponse.java
@@ -15,7 +15,6 @@
import java.math.BigInteger;
import java.net.http.HttpResponse;
import java.util.Optional;
-import java.util.concurrent.Callable;
public class GetSessionListResponse implements com.clerk.backend_api.utils.Response {
@@ -39,8 +38,6 @@ public class GetSessionListResponse implements com.clerk.backend_api.utils.Respo
*/
private Optional extends java.util.List> sessionList;
- private Callable> next = () -> Optional.empty();
-
@JsonCreator
public GetSessionListResponse(
String contentType,
@@ -97,16 +94,6 @@ public Optional>
return (Optional>) sessionList;
}
- public Optional next() throws Exception {
- return this.next.call();
- }
-
- // internal use only
- private GetSessionListResponse withNext(Callable> next) {
- this.next = next;
- return this;
- }
-
public final static Builder builder() {
return new Builder();
}
@@ -191,7 +178,6 @@ public String toString() {
}
public final static class Builder {
- private Callable> next;
private String contentType;
@@ -249,26 +235,13 @@ public Builder sessionList(Optional extends java.util.List> next) {
- Utils.checkNotNull(next, "next");
- this.next = next;
- return this;
- }
public GetSessionListResponse build() {
return new GetSessionListResponse(
contentType,
statusCode,
rawResponse,
- sessionList)
- .withNext(next);
+ sessionList);
}
}
}
diff --git a/src/main/java/com/clerk/backend_api/models/operations/GetUserListRequestBuilder.java b/src/main/java/com/clerk/backend_api/models/operations/GetUserListRequestBuilder.java
index 7334f0a..cb490ef 100644
--- a/src/main/java/com/clerk/backend_api/models/operations/GetUserListRequestBuilder.java
+++ b/src/main/java/com/clerk/backend_api/models/operations/GetUserListRequestBuilder.java
@@ -37,25 +37,4 @@ public GetUserListResponse call() throws Exception {
return sdk.list(
request);
}
-
- /**
- * Returns a stream that performs next page calls till no more pages
- * are returned. Unlike the {@link #call()} method this method will
- * throw an {@link SDKError} if any page retrieval has an HTTP status
- * code >= 300 (Note that 3XX is not an error range but will need
- * special handling by the user if for example the HTTP client is
- * not configured to follow redirects).
- *
- * @throws {@link SDKError} if HTTP status code >= 300 is encountered
- **/
- public Stream callAsStream() {
- return Utils.stream(() -> Optional.of(call()), x -> {
- if (x.statusCode() >= 300) {
- byte[] body = Utils.toByteArrayAndClose(x.rawResponse().body());
- throw new SDKError(x.rawResponse(), x.statusCode(), x.contentType(), body);
- } else {
- return x.next();
- }
- });
- }
}
diff --git a/src/main/java/com/clerk/backend_api/models/operations/GetUserListResponse.java b/src/main/java/com/clerk/backend_api/models/operations/GetUserListResponse.java
index aae957e..4a26bfe 100644
--- a/src/main/java/com/clerk/backend_api/models/operations/GetUserListResponse.java
+++ b/src/main/java/com/clerk/backend_api/models/operations/GetUserListResponse.java
@@ -15,7 +15,6 @@
import java.math.BigInteger;
import java.net.http.HttpResponse;
import java.util.Optional;
-import java.util.concurrent.Callable;
public class GetUserListResponse implements com.clerk.backend_api.utils.Response {
@@ -39,8 +38,6 @@ public class GetUserListResponse implements com.clerk.backend_api.utils.Response
*/
private Optional extends java.util.List> userList;
- private Callable> next = () -> Optional.empty();
-
@JsonCreator
public GetUserListResponse(
String contentType,
@@ -97,16 +94,6 @@ public Optional> us
return (Optional>) userList;
}
- public Optional next() throws Exception {
- return this.next.call();
- }
-
- // internal use only
- private GetUserListResponse withNext(Callable> next) {
- this.next = next;
- return this;
- }
-
public final static Builder builder() {
return new Builder();
}
@@ -191,7 +178,6 @@ public String toString() {
}
public final static class Builder {
- private Callable> next;
private String contentType;
@@ -249,26 +235,13 @@ public Builder userList(Optional extends java.util.List> next) {
- Utils.checkNotNull(next, "next");
- this.next = next;
- return this;
- }
public GetUserListResponse build() {
return new GetUserListResponse(
contentType,
statusCode,
rawResponse,
- userList)
- .withNext(next);
+ userList);
}
}
}
diff --git a/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsRequestBuilder.java b/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsRequestBuilder.java
index 514c96c..4ca1641 100644
--- a/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsRequestBuilder.java
+++ b/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsRequestBuilder.java
@@ -37,25 +37,4 @@ public ListOrganizationsResponse call() throws Exception {
return sdk.list(
request);
}
-
- /**
- * Returns a stream that performs next page calls till no more pages
- * are returned. Unlike the {@link #call()} method this method will
- * throw an {@link SDKError} if any page retrieval has an HTTP status
- * code >= 300 (Note that 3XX is not an error range but will need
- * special handling by the user if for example the HTTP client is
- * not configured to follow redirects).
- *
- * @throws {@link SDKError} if HTTP status code >= 300 is encountered
- **/
- public Stream callAsStream() {
- return Utils.stream(() -> Optional.of(call()), x -> {
- if (x.statusCode() >= 300) {
- byte[] body = Utils.toByteArrayAndClose(x.rawResponse().body());
- throw new SDKError(x.rawResponse(), x.statusCode(), x.contentType(), body);
- } else {
- return x.next();
- }
- });
- }
}
diff --git a/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsResponse.java b/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsResponse.java
index 05645dd..b19b822 100644
--- a/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsResponse.java
+++ b/src/main/java/com/clerk/backend_api/models/operations/ListOrganizationsResponse.java
@@ -15,7 +15,6 @@
import java.math.BigInteger;
import java.net.http.HttpResponse;
import java.util.Optional;
-import java.util.concurrent.Callable;
public class ListOrganizationsResponse implements com.clerk.backend_api.utils.Response {
@@ -39,8 +38,6 @@ public class ListOrganizationsResponse implements com.clerk.backend_api.utils.Re
*/
private Optional extends com.clerk.backend_api.models.components.Organizations> organizations;
- private Callable> next = () -> Optional.empty();
-
@JsonCreator
public ListOrganizationsResponse(
String contentType,
@@ -97,16 +94,6 @@ public Optional organizat
return (Optional) organizations;
}
- public Optional next() throws Exception {
- return this.next.call();
- }
-
- // internal use only
- private ListOrganizationsResponse withNext(Callable> next) {
- this.next = next;
- return this;
- }
-
public final static Builder builder() {
return new Builder();
}
@@ -191,7 +178,6 @@ public String toString() {
}
public final static class Builder {
- private Callable> next;
private String contentType;
@@ -249,26 +235,13 @@ public Builder organizations(Optional extends com.clerk.backend_api.models.com
this.organizations = organizations;
return this;
}
-
- /**
- * Internal API. Not for public use. Sets the provider of the next page.
- *
- * @deprecated not part of the public API, may be removed without notice
- */
- @Deprecated
- public Builder next(Callable> next) {
- Utils.checkNotNull(next, "next");
- this.next = next;
- return this;
- }
public ListOrganizationsResponse build() {
return new ListOrganizationsResponse(
contentType,
statusCode,
rawResponse,
- organizations)
- .withNext(next);
+ organizations);
}
}
}