From b68f5ef0b7cad537159fcf4b2637b12f5d97b62d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:34:54 -0500 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.441.2 (#18) Co-authored-by: speakeasybot --- .speakeasy/gen.lock | 9 +- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 19 +- README.md | 244 ++++++++++++------ RELEASES.md | 12 +- build.gradle | 27 +- gradlew.bat | 184 ++++++------- settings.gradle | 2 +- .../com/goshippo/sdk/SDKConfiguration.java | 4 +- 9 files changed, 315 insertions(+), 188 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 69625fc2..ec89b069 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,11 +3,12 @@ id: 83c79445-e1aa-4008-8835-519234c13f68 management: docChecksum: bf61704a99aaaf3476d24bb0d505a88c docVersion: "2018-02-08" - speakeasyVersion: 1.441.1 - generationVersion: 2.461.2 - releaseVersion: 1.0.0-beta - configChecksum: dad5be879d82ab7fba0fcf7b441ed4a8 + speakeasyVersion: 1.441.2 + generationVersion: 2.461.4 + releaseVersion: 1.0.0-beta.1 + configChecksum: 8a2d90092207cde728720bd7a0fbc889 repoURL: https://github.com/goshippo/shippo-java-sdk.git + published: true features: java: additionalDependencies: 0.1.0 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 0f7ea123..b2c53cf6 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false java: - version: 1.0.0-beta + version: 1.0.0-beta.1 additionalDependencies: [] additionalPlugins: - id 'groovy' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8284cf48..3d3a9e4d 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,19 +1,20 @@ -speakeasyVersion: 1.441.1 +speakeasyVersion: 1.441.2 sources: my-first-source: sourceNamespace: my-first-source - sourceRevisionDigest: sha256:9627d5070a4f07da7f5477caf13cb84b0fa477fef32e716629630248b09349b3 - sourceBlobDigest: sha256:cb17e1095674471608b63041b0cd3a59f9f47028eeb45c5f22004f7f6fbb19c1 + sourceRevisionDigest: sha256:b7a5f00224fde68f5c68a9f4dd3d077b0d25f491e519ffc69758b407a0e2909c + sourceBlobDigest: sha256:b267e444289e13e5381eb13cc6671b99c9498b3c6f27111df668633f7ebb7f43 tags: - latest + - speakeasy-sdk-regen-1732213941 targets: my-first-target: source: my-first-source sourceNamespace: my-first-source - sourceRevisionDigest: sha256:9627d5070a4f07da7f5477caf13cb84b0fa477fef32e716629630248b09349b3 - sourceBlobDigest: sha256:cb17e1095674471608b63041b0cd3a59f9f47028eeb45c5f22004f7f6fbb19c1 + sourceRevisionDigest: sha256:b7a5f00224fde68f5c68a9f4dd3d077b0d25f491e519ffc69758b407a0e2909c + sourceBlobDigest: sha256:b267e444289e13e5381eb13cc6671b99c9498b3c6f27111df668633f7ebb7f43 codeSamplesNamespace: my-first-source-code-samples - codeSamplesRevisionDigest: sha256:bdad0d51db4fe89fe0123c96bd9fb5d22a650ae33f9fcc291de08e1dd7ae750c + codeSamplesRevisionDigest: sha256:45c308b6146e78c1e75de14d33c990910dba6e191df6adb384da7a1f35aa73df workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -27,6 +28,12 @@ workflow: my-first-target: target: java source: my-first-source + publish: + java: + ossrhUsername: lucas-shippo + ossrhPassword: $ossrh_password + gpgSecretKey: $java_gpg_secret_key + gpgPassPhrase: $java_gpg_passphrase codeSamples: registry: location: registry.speakeasyapi.dev/shippo/shippo/my-first-source-code-samples diff --git a/README.md b/README.md index cc176fae..67fa9e82 100644 --- a/README.md +++ b/README.md @@ -44,83 +44,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.shippo:sdk:1.0.0-beta' -``` - -Maven: -```xml - - com.shippo - sdk - 1.0.0-beta - -``` - -## SDK Example Usage - -### Example - -```java -package hello.world; - -import com.shippo.sdk.Shippo; -import com.shippo.sdk.models.components.Security; -import com.shippo.sdk.utils.EventStream; - -import org.openapitools.jackson.nullable.JsonNullable; - -public class Application { - - public static void main(String[] args) throws Exception { - try { - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - // the API version can be globally set, though this is normally not required - // .shippoApiVersion("") - .build(); - - ListAddressesResponse res = sdk.addresses().list() - .page(1L) - .results(5L) - .call(); - - if (res.addressPaginatedList().isPresent()) { - // handle response - } - } catch (com.shippo.sdk.models.errors.SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - } -} -``` - - - - - - - -## Documentation -Review our full guides and references at [https://docs.goshippo.com/](https://docs.goshippo.com/). - - - - -## SDK Installation - -### Getting started - -JDK 11 or later is required. - -The samples below show how a published SDK artifact is used: - -Gradle: -```groovy -implementation 'com.goshippo:sdk:1.0.0-beta' +implementation 'com.goshippo:sdk:1.0.0-beta.1' ``` Maven: @@ -128,7 +52,7 @@ Maven: com.goshippo sdk - 1.0.0-beta + 1.0.0-beta.1 ``` @@ -147,6 +71,41 @@ gradlew.bat publishToMavenLocal -Pskip.signing ``` + +## SDK Example Usage + +### Example + +```java +package hello.world; + +import com.goshippo.sdk.Shippo; +import com.goshippo.sdk.models.operations.ListAddressesResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Shippo sdk = Shippo.builder() + .apiKeyHeader("") + .shippoApiVersion("2018-02-08") + .build(); + + ListAddressesResponse res = sdk.addresses().list() + .page(1L) + .results(5L) + .shippoApiVersion("2018-02-08") + .call(); + + if (res.addressPaginatedList().isPresent()) { + // handle response + } + } +} +``` + + ## Available Resources and Operations @@ -304,4 +263,131 @@ Feel free to open a PR or a Github issue as a proof of concept and we'll do our Connect with multiple different carriers, get discounted shipping labels, track parcels, and much more with just one integration. You can use your own carrier accounts or take advantage of our discounted rates with the Shippo carrier accounts. Using Shippo makes it easy to deal with multiple carrier integrations, rate shopping, tracking and other parts of the shipping workflow. -We provide the API and web app for all your shipping needs. +We provide the API and web app for all your shipping needs. +## Error Handling + +Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception. + +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 `initiateOauth2Signin` method throws the following exceptions: + +| Error Type | Status Code | Content Type | +| --------------------------------------------------------------------- | ----------- | ---------------- | +| models/errors/InitiateOauth2SigninResponseBody | 400 | application/json | +| models/errors/InitiateOauth2SigninCarrierAccountsResponseBody | 401 | application/json | +| models/errors/InitiateOauth2SigninCarrierAccountsResponseResponseBody | 404 | application/json | +| models/errors/SDKError | 4XX, 5XX | \*/\* | + +### Example + +```java +package hello.world; + +import com.goshippo.sdk.Shippo; +import com.goshippo.sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseBody; +import com.goshippo.sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody; +import com.goshippo.sdk.models.errors.InitiateOauth2SigninResponseBody; +import com.goshippo.sdk.models.operations.InitiateOauth2SigninResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws InitiateOauth2SigninResponseBody, InitiateOauth2SigninCarrierAccountsResponseBody, InitiateOauth2SigninCarrierAccountsResponseResponseBody, Exception { + + Shippo sdk = Shippo.builder() + .apiKeyHeader("") + .shippoApiVersion("2018-02-08") + .build(); + + InitiateOauth2SigninResponse res = sdk.carrierAccounts().initiateOauth2Signin() + .carrierAccountObjectId("") + .redirectUri("https://enlightened-mortise.com/") + .state("Louisiana") + .shippoApiVersion("2018-02-08") + .call(); + + // handle response + } +} +``` + + + +## Server Selection + +### Override Server URL Per-Client + +The default server can also be overridden globally using the `.serverURL(String serverUrl)` builder method when initializing the SDK client instance. For example: +```java +package hello.world; + +import com.goshippo.sdk.Shippo; +import com.goshippo.sdk.models.operations.ListAddressesResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Shippo sdk = Shippo.builder() + .serverURL("https://api.goshippo.com") + .apiKeyHeader("") + .shippoApiVersion("2018-02-08") + .build(); + + ListAddressesResponse res = sdk.addresses().list() + .page(1L) + .results(5L) + .shippoApiVersion("2018-02-08") + .call(); + + if (res.addressPaginatedList().isPresent()) { + // handle response + } + } +} +``` + + + +## Authentication + +### Per-Client Security Schemes + +This SDK supports the following security scheme globally: + +| Name | Type | Scheme | +| -------------- | ------ | ------- | +| `apiKeyHeader` | apiKey | API key | + +To authenticate with the API the `apiKeyHeader` parameter must be set when initializing the SDK client instance. For example: +```java +package hello.world; + +import com.goshippo.sdk.Shippo; +import com.goshippo.sdk.models.operations.ListAddressesResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Shippo sdk = Shippo.builder() + .apiKeyHeader("") + .shippoApiVersion("2018-02-08") + .build(); + + ListAddressesResponse res = sdk.addresses().list() + .page(1L) + .results(5L) + .shippoApiVersion("2018-02-08") + .call(); + + if (res.addressPaginatedList().isPresent()) { + // handle response + } + } +} +``` + + + diff --git a/RELEASES.md b/RELEASES.md index 58b88b22..9342af75 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -30,4 +30,14 @@ Based on: - OpenAPI Doc - Speakeasy CLI 1.401.2 (2.421.3) https://github.com/speakeasy-api/speakeasy ### Generated -- [java v0.4.0] . \ No newline at end of file +- [java v0.4.0] . + +## 2024-11-21 18:32:17 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.441.2 (2.461.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v1.0.0-beta.1] . +### Releases +- [Maven Central v1.0.0-beta.1] https://central.sonatype.com/artifact/com.goshippo/sdk/1.0.0-beta.1 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 45d0715b..65dfd9f8 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,7 @@ plugins { id 'java-library' id 'maven-publish' id 'signing' + id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3' id 'groovy' } @@ -41,6 +42,7 @@ model { jar { dependsOn(":generatePomFileForMavenPublication") + archiveBaseName = "sdk" into("META-INF/maven/com.goshippo/sdk") { from("$buildDir/pom.xml") @@ -62,7 +64,7 @@ tasks.withType(Javadoc) { } group = "com.goshippo" -version = "1.0.0-beta" +version = "1.0.0-beta.1" sourcesJar { archiveBaseName = "sdk" @@ -71,6 +73,27 @@ sourcesJar { javadocJar { archiveBaseName = "sdk" } +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/sdk-${version}.jar", + "$buildDir/libs/sdk-${version}-sources.jar", + "$buildDir/libs/sdk-${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 { @@ -79,7 +102,7 @@ publishing { maven(MavenPublication) { groupId = 'com.goshippo' artifactId = 'sdk' - version = '1.0.0-beta' + version = '1.0.0-beta.1' from components.java diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f..6689b85b 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 2eba4e7b..73e69eae 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 = 'api' +rootProject.name = 'sdk' diff --git a/src/main/java/com/goshippo/sdk/SDKConfiguration.java b/src/main/java/com/goshippo/sdk/SDKConfiguration.java index f730c8f6..bf017f15 100644 --- a/src/main/java/com/goshippo/sdk/SDKConfiguration.java +++ b/src/main/java/com/goshippo/sdk/SDKConfiguration.java @@ -27,8 +27,8 @@ public Optional securitySource() { public int serverIdx = 0; private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "2018-02-08"; - public static final String SDK_VERSION = "1.0.0-beta"; - public static final String GEN_VERSION = "2.461.2"; + public static final String SDK_VERSION = "1.0.0-beta.1"; + public static final String GEN_VERSION = "2.461.4"; private static final String BASE_PACKAGE = "com.goshippo.sdk"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s",