From eb967be535bee12da1abafc37e5dafd168366dc5 Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 13 Jan 2025 11:36:47 -0500 Subject: [PATCH] generator --- .../no-inline/.github/workflows/ci.yml | 61 ++ .../java-inline-types/no-inline/.gitignore | 24 + .../.mock/definition/__package__.yml | 107 ++ .../no-inline/.mock/definition/api.yml | 1 + .../no-inline/.mock/fern.config.json | 1 + .../no-inline/.mock/generators.yml | 1 + .../java-inline-types/no-inline/build.gradle | 101 ++ .../no-inline/sample-app/build.gradle | 19 + .../sample-app/src/main/java/sample/App.java | 13 + .../no-inline/settings.gradle | 3 + .../no-inline/snippet-templates.json | 0 .../java-inline-types/no-inline/snippet.json | 0 .../com/seed/object/SeedObjectClient.java | 18 + .../seed/object/SeedObjectClientBuilder.java | 31 + .../com/seed/object/core/ClientOptions.java | 118 +++ .../object/core/DateTimeDeserializer.java | 55 + .../com/seed/object/core/Environment.java | 20 + .../java/com/seed/object/core/FileStream.java | 60 ++ .../object/core/InputStreamRequestBody.java | 79 ++ .../java/com/seed/object/core/MediaTypes.java | 13 + .../com/seed/object/core/ObjectMappers.java | 36 + .../com/seed/object/core/RequestOptions.java | 58 + .../object/core/ResponseBodyInputStream.java | 45 + .../seed/object/core/ResponseBodyReader.java | 44 + .../seed/object/core/RetryInterceptor.java | 78 ++ .../object/core/SeedObjectApiException.java | 45 + .../seed/object/core/SeedObjectException.java | 17 + .../java/com/seed/object/core/Stream.java | 97 ++ .../java/com/seed/object/core/Suppliers.java | 23 + .../seed/object/types/AliasInlineValue.java | 124 +++ .../seed/object/types/AliasListInline.java | 42 + .../com/seed/object/types/AliasMapInline.java | 41 + .../com/seed/object/types/AliasSetInline.java | 41 + .../com/seed/object/types/ReferenceType.java | 109 ++ .../java/com/seed/object/types/RootType1.java | 992 ++++++++++++++++++ .../object/types/RootType1FooListItem.java | 138 +++ .../object/types/RootType1FooMapValue.java | 138 +++ .../object/types/RootType1FooSetItem.java | 138 +++ .../object/types/RootType1InlineType1.java | 317 ++++++ ...RootType1InlineType1NestedInlineType1.java | 169 +++ .../java/com/seed/object/types/RootType2.java | 40 + .../java/com/seed/object/types/TestType.java | 102 ++ .../test/java/com/seed/object/TestClient.java | 11 + .../.github/workflows/ci.yml | 61 ++ .../no-wrapped-aliases/.gitignore | 24 + .../.mock/definition/__package__.yml | 107 ++ .../.mock/definition/api.yml | 1 + .../no-wrapped-aliases/.mock/fern.config.json | 1 + .../no-wrapped-aliases/.mock/generators.yml | 1 + .../no-wrapped-aliases/build.gradle | 101 ++ .../sample-app/build.gradle | 19 + .../sample-app/src/main/java/sample/App.java | 13 + .../no-wrapped-aliases/settings.gradle | 3 + .../no-wrapped-aliases/snippet-templates.json | 0 .../no-wrapped-aliases/snippet.json | 0 .../com/seed/object/SeedObjectClient.java | 18 + .../seed/object/SeedObjectClientBuilder.java | 31 + .../com/seed/object/core/ClientOptions.java | 118 +++ .../object/core/DateTimeDeserializer.java | 55 + .../com/seed/object/core/Environment.java | 20 + .../java/com/seed/object/core/FileStream.java | 60 ++ .../object/core/InputStreamRequestBody.java | 79 ++ .../java/com/seed/object/core/MediaTypes.java | 13 + .../com/seed/object/core/ObjectMappers.java | 36 + .../com/seed/object/core/RequestOptions.java | 58 + .../object/core/ResponseBodyInputStream.java | 45 + .../seed/object/core/ResponseBodyReader.java | 44 + .../seed/object/core/RetryInterceptor.java | 78 ++ .../object/core/SeedObjectApiException.java | 45 + .../seed/object/core/SeedObjectException.java | 17 + .../java/com/seed/object/core/Stream.java | 97 ++ .../java/com/seed/object/core/Suppliers.java | 23 + .../com/seed/object/types/ReferenceType.java | 109 ++ .../java/com/seed/object/types/RootType1.java | 992 ++++++++++++++++++ .../java/com/seed/object/types/TestType.java | 102 ++ .../test/java/com/seed/object/TestClient.java | 11 + 76 files changed, 5952 insertions(+) create mode 100644 seed/java-sdk/java-inline-types/no-inline/.github/workflows/ci.yml create mode 100644 seed/java-sdk/java-inline-types/no-inline/.gitignore create mode 100644 seed/java-sdk/java-inline-types/no-inline/.mock/definition/__package__.yml create mode 100644 seed/java-sdk/java-inline-types/no-inline/.mock/definition/api.yml create mode 100644 seed/java-sdk/java-inline-types/no-inline/.mock/fern.config.json create mode 100644 seed/java-sdk/java-inline-types/no-inline/.mock/generators.yml create mode 100644 seed/java-sdk/java-inline-types/no-inline/build.gradle create mode 100644 seed/java-sdk/java-inline-types/no-inline/sample-app/build.gradle create mode 100644 seed/java-sdk/java-inline-types/no-inline/sample-app/src/main/java/sample/App.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/settings.gradle create mode 100644 seed/java-sdk/java-inline-types/no-inline/snippet-templates.json create mode 100644 seed/java-sdk/java-inline-types/no-inline/snippet.json create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClient.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClientBuilder.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ClientOptions.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/DateTimeDeserializer.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Environment.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/FileStream.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/InputStreamRequestBody.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/MediaTypes.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ObjectMappers.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RequestOptions.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyInputStream.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyReader.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RetryInterceptor.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectApiException.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectException.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Stream.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Suppliers.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasInlineValue.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasListInline.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasMapInline.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasSetInline.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/ReferenceType.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooListItem.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooMapValue.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooSetItem.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1NestedInlineType1.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType2.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/TestType.java create mode 100644 seed/java-sdk/java-inline-types/no-inline/src/test/java/com/seed/object/TestClient.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/.github/workflows/ci.yml create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/.gitignore create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/__package__.yml create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/api.yml create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/fern.config.json create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/generators.yml create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/build.gradle create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/build.gradle create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/src/main/java/sample/App.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/settings.gradle create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/snippet-templates.json create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/snippet.json create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClient.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClientBuilder.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ClientOptions.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/DateTimeDeserializer.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Environment.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/FileStream.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/InputStreamRequestBody.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/MediaTypes.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ObjectMappers.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RequestOptions.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyInputStream.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyReader.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RetryInterceptor.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectApiException.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectException.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Stream.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Suppliers.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/ReferenceType.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/RootType1.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/TestType.java create mode 100644 seed/java-sdk/java-inline-types/no-wrapped-aliases/src/test/java/com/seed/object/TestClient.java diff --git a/seed/java-sdk/java-inline-types/no-inline/.github/workflows/ci.yml b/seed/java-sdk/java-inline-types/no-inline/.github/workflows/ci.yml new file mode 100644 index 00000000000..9910fd269c2 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: ci + +on: [push] + +jobs: + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Compile + run: ./gradlew compileJava + + test: + needs: [ compile ] + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Test + run: ./gradlew test + publish: + needs: [ compile, test ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Publish to maven + run: | + ./gradlew publish + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_PUBLISH_REGISTRY_URL: "" diff --git a/seed/java-sdk/java-inline-types/no-inline/.gitignore b/seed/java-sdk/java-inline-types/no-inline/.gitignore new file mode 100644 index 00000000000..d4199abc2cd --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/.gitignore @@ -0,0 +1,24 @@ +*.class +.project +.gradle +? +.classpath +.checkstyle +.settings +.node +build + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ +out/ + +# Eclipse/IntelliJ APT +generated_src/ +generated_testSrc/ +generated/ + +bin +build \ No newline at end of file diff --git a/seed/java-sdk/java-inline-types/no-inline/.mock/definition/__package__.yml b/seed/java-sdk/java-inline-types/no-inline/.mock/definition/__package__.yml new file mode 100644 index 00000000000..0151adee51a --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/.mock/definition/__package__.yml @@ -0,0 +1,107 @@ +types: + # this is also the type that would be produced by + AliasMapInline: map + AliasSetInline: set + AliasListInline: list + + AliasInlineValue: + inline: true + properties: + foo: string + bar: string + + RootType2: RootType1 + + TestType: + properties: + testProperty: RootType2 + + RootType1: + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + bar: + type: RootType1InlineType1 + docs: lorem ipsum + fooMap: + type: map + docs: lorem ipsum + fooList: + type: list + docs: lorem ipsum + fooSet: + type: set + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1FooMapValue: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1FooListItem: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1FooSetItem: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1InlineType1: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + bar: + type: RootType1InlineType1NestedInlineType1 + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1InlineType1NestedInlineType1: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + bar: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + ReferenceType: + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum diff --git a/seed/java-sdk/java-inline-types/no-inline/.mock/definition/api.yml b/seed/java-sdk/java-inline-types/no-inline/.mock/definition/api.yml new file mode 100644 index 00000000000..a82930c145b --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/.mock/definition/api.yml @@ -0,0 +1 @@ +name: object diff --git a/seed/java-sdk/java-inline-types/no-inline/.mock/fern.config.json b/seed/java-sdk/java-inline-types/no-inline/.mock/fern.config.json new file mode 100644 index 00000000000..4c8e54ac313 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "*"} \ No newline at end of file diff --git a/seed/java-sdk/java-inline-types/no-inline/.mock/generators.yml b/seed/java-sdk/java-inline-types/no-inline/.mock/generators.yml new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/.mock/generators.yml @@ -0,0 +1 @@ +{} diff --git a/seed/java-sdk/java-inline-types/no-inline/build.gradle b/seed/java-sdk/java-inline-types/no-inline/build.gradle new file mode 100644 index 00000000000..12b766eeed2 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/build.gradle @@ -0,0 +1,101 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + api 'com.squareup.okhttp3:okhttp:4.12.0' + api 'com.fasterxml.jackson.core:jackson-databind:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +tasks.withType(Javadoc) { + failOnError false + options.addStringOption('Xdoclint:none', '-quiet') +} + +spotless { + java { + palantirJavaFormat() + } +} + + +java { + withSourcesJar() + withJavadocJar() +} + + +group = 'com.fern' + +version = '0.0.1' + +jar { + dependsOn(":generatePomFileForMavenPublication") + archiveBaseName = "java-inline-types" +} + +sourcesJar { + archiveBaseName = "java-inline-types" +} + +javadocJar { + archiveBaseName = "java-inline-types" +} + +test { + useJUnitPlatform() + testLogging { + showStandardStreams = true + } +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'com.fern' + artifactId = 'java-inline-types' + version = '0.0.1' + from components.java + pom { + licenses { + license { + name = 'The MIT License (MIT)' + url = 'https://mit-license.org/' + } + } + scm { + connection = 'scm:git:git://github.com/java-inline-types/fern.git' + developerConnection = 'scm:git:git://github.com/java-inline-types/fern.git' + url = 'https://github.com/java-inline-types/fern' + } + } + } + } + repositories { + maven { + url "$System.env.MAVEN_PUBLISH_REGISTRY_URL" + credentials { + username "$System.env.MAVEN_USERNAME" + password "$System.env.MAVEN_PASSWORD" + } + } + } +} + diff --git a/seed/java-sdk/java-inline-types/no-inline/sample-app/build.gradle b/seed/java-sdk/java-inline-types/no-inline/sample-app/build.gradle new file mode 100644 index 00000000000..4ee8f227b7a --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/sample-app/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + implementation rootProject +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + diff --git a/seed/java-sdk/java-inline-types/no-inline/sample-app/src/main/java/sample/App.java b/seed/java-sdk/java-inline-types/no-inline/sample-app/src/main/java/sample/App.java new file mode 100644 index 00000000000..b115384f1d2 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/sample-app/src/main/java/sample/App.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +package sample; + +import java.lang.String; + +public final class App { + public static void main(String[] args) { + // import com.seed.object.SeedObjectClient + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/settings.gradle b/seed/java-sdk/java-inline-types/no-inline/settings.gradle new file mode 100644 index 00000000000..8526e13fb82 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'java-inline-types' + +include 'sample-app' \ No newline at end of file diff --git a/seed/java-sdk/java-inline-types/no-inline/snippet-templates.json b/seed/java-sdk/java-inline-types/no-inline/snippet-templates.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/seed/java-sdk/java-inline-types/no-inline/snippet.json b/seed/java-sdk/java-inline-types/no-inline/snippet.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClient.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClient.java new file mode 100644 index 00000000000..2cf6b8d40e5 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClient.java @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object; + +import com.seed.object.core.ClientOptions; + +public class SeedObjectClient { + protected final ClientOptions clientOptions; + + public SeedObjectClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public static SeedObjectClientBuilder builder() { + return new SeedObjectClientBuilder(); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClientBuilder.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClientBuilder.java new file mode 100644 index 00000000000..49263572b1a --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/SeedObjectClientBuilder.java @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object; + +import com.seed.object.core.ClientOptions; +import com.seed.object.core.Environment; + +public final class SeedObjectClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private Environment environment; + + public SeedObjectClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client + */ + public SeedObjectClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + public SeedObjectClient build() { + clientOptionsBuilder.environment(this.environment); + return new SeedObjectClient(clientOptionsBuilder.build()); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ClientOptions.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ClientOptions.java new file mode 100644 index 00000000000..63e04e1a6ba --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ClientOptions.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int timeout = 60; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = timeout; + return this; + } + + public ClientOptions build() { + OkHttpClient okhttpClient = new OkHttpClient.Builder() + .addInterceptor(new RetryInterceptor(3)) + .callTimeout(this.timeout, TimeUnit.SECONDS) + .build(); + return new ClientOptions(environment, headers, headerSuppliers, okhttpClient, this.timeout); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/DateTimeDeserializer.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/DateTimeDeserializer.java new file mode 100644 index 00000000000..ad231070a3d --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Environment.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Environment.java new file mode 100644 index 00000000000..19b694c5b93 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Environment.java @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +public final class Environment { + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/FileStream.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/FileStream.java new file mode 100644 index 00000000000..eef28eef8bd --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/InputStreamRequestBody.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/InputStreamRequestBody.java new file mode 100644 index 00000000000..433d823fbed --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/MediaTypes.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/MediaTypes.java new file mode 100644 index 00000000000..df45659067e --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ObjectMappers.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ObjectMappers.java new file mode 100644 index 00000000000..c889a5b4c3d --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RequestOptions.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RequestOptions.java new file mode 100644 index 00000000000..5ea45c533b5 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RequestOptions.java @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + +public final class RequestOptions { + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private RequestOptions(Optional timeout, TimeUnit timeoutTimeUnit) { + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public RequestOptions build() { + return new RequestOptions(timeout, timeoutTimeUnit); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyInputStream.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyInputStream.java new file mode 100644 index 00000000000..ea75c68fd88 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyReader.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyReader.java new file mode 100644 index 00000000000..3903eb7436c --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RetryInterceptor.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RetryInterceptor.java new file mode 100644 index 00000000000..9f541cea8fc --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 409 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectApiException.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectApiException.java new file mode 100644 index 00000000000..64ec8313ea1 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectApiException.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class SeedObjectApiException extends SeedObjectException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public SeedObjectApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + @java.lang.Override + public String toString() { + return "SeedObjectApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + body + "}"; + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectException.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectException.java new file mode 100644 index 00000000000..a338879cb59 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/SeedObjectException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class SeedObjectException extends RuntimeException { + public SeedObjectException(String message) { + super(message); + } + + public SeedObjectException(String message, Exception e) { + super(message, e); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Stream.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Stream.java new file mode 100644 index 00000000000..ecc1492c728 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Stream.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implmenets {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable { + /** + * The {@link Class} of the objects in the stream. + */ + private final Class valueType; + /** + * The {@link Scanner} used for reading from the input stream and blocking when neede during iteration. + */ + private final Scanner scanner; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.valueType = valueType; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + return new Iterator() { + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + /** + * Removing elements from {@code Stream} is not supported. + * + * @throws UnsupportedOperationException Always, as removal is not supported. + */ + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Suppliers.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Suppliers.java new file mode 100644 index 00000000000..5001ddf4767 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasInlineValue.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasInlineValue.java new file mode 100644 index 00000000000..94b422a1540 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasInlineValue.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AliasInlineValue.Builder.class) +public final class AliasInlineValue { + private final String foo; + + private final String bar; + + private final Map additionalProperties; + + private AliasInlineValue(String foo, String bar, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AliasInlineValue && equalTo((AliasInlineValue) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AliasInlineValue other) { + return foo.equals(other.foo) && bar.equals(other.bar); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(AliasInlineValue other); + } + + public interface BarStage { + _FinalStage bar(@NotNull String bar); + } + + public interface _FinalStage { + AliasInlineValue build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, _FinalStage { + private String foo; + + private String bar; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AliasInlineValue other) { + foo(other.getFoo()); + bar(other.getBar()); + return this; + } + + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("bar") + public _FinalStage bar(@NotNull String bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + @java.lang.Override + public AliasInlineValue build() { + return new AliasInlineValue(foo, bar, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasListInline.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasListInline.java new file mode 100644 index 00000000000..c75c5713721 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasListInline.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.List; + +public final class AliasListInline { + private final List value; + + private AliasListInline(List value) { + this.value = value; + } + + @JsonValue + public List get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof AliasListInline && this.value.equals(((AliasListInline) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AliasListInline of(List value) { + return new AliasListInline(value); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasMapInline.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasMapInline.java new file mode 100644 index 00000000000..49fb39ae7f7 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasMapInline.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Map; + +public final class AliasMapInline { + private final Map value; + + private AliasMapInline(Map value) { + this.value = value; + } + + @JsonValue + public Map get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof AliasMapInline && this.value.equals(((AliasMapInline) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AliasMapInline of(Map value) { + return new AliasMapInline(value); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasSetInline.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasSetInline.java new file mode 100644 index 00000000000..28f588121e0 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/AliasSetInline.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Set; + +public final class AliasSetInline { + private final Set value; + + private AliasSetInline(Set value) { + this.value = value; + } + + @JsonValue + public Set get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof AliasSetInline && this.value.equals(((AliasSetInline) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AliasSetInline of(Set value) { + return new AliasSetInline(value); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/ReferenceType.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/ReferenceType.java new file mode 100644 index 00000000000..f420a13f682 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/ReferenceType.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferenceType.Builder.class) +public final class ReferenceType { + private final String foo; + + private final Map additionalProperties; + + private ReferenceType(String foo, Map additionalProperties) { + this.foo = foo; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferenceType && equalTo((ReferenceType) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferenceType other) { + return foo.equals(other.foo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + _FinalStage foo(@NotNull String foo); + + Builder from(ReferenceType other); + } + + public interface _FinalStage { + ReferenceType build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, _FinalStage { + private String foo; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReferenceType other) { + foo(other.getFoo()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public _FinalStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + @java.lang.Override + public ReferenceType build() { + return new ReferenceType(foo, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1.java new file mode 100644 index 00000000000..3d90028eda5 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1.java @@ -0,0 +1,992 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RootType1.Builder.class) +public final class RootType1 { + private final String foo; + + private final Bar bar; + + private final Map fooMap; + + private final List fooList; + + private final Set fooSet; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private RootType1( + String foo, + Bar bar, + Map fooMap, + List fooList, + Set fooSet, + ReferenceType ref, + Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.fooMap = fooMap; + this.fooList = fooList; + this.fooSet = fooSet; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public Bar getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("fooMap") + public Map getFooMap() { + return fooMap; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("fooList") + public List getFooList() { + return fooList; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("fooSet") + public Set getFooSet() { + return fooSet; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1 && equalTo((RootType1) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1 other) { + return foo.equals(other.foo) + && bar.equals(other.bar) + && fooMap.equals(other.fooMap) + && fooList.equals(other.fooList) + && fooSet.equals(other.fooSet) + && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.fooMap, this.fooList, this.fooSet, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(RootType1 other); + } + + public interface BarStage { + RefStage bar(@NotNull Bar bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1 build(); + + _FinalStage fooMap(Map fooMap); + + _FinalStage putAllFooMap(Map fooMap); + + _FinalStage fooMap(String key, FooMapValue value); + + _FinalStage fooList(List fooList); + + _FinalStage addFooList(FooListItem fooList); + + _FinalStage addAllFooList(List fooList); + + _FinalStage fooSet(Set fooSet); + + _FinalStage addFooSet(FooSetItem fooSet); + + _FinalStage addAllFooSet(Set fooSet); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private Bar bar; + + private ReferenceType ref; + + private Set fooSet = new LinkedHashSet<>(); + + private List fooList = new ArrayList<>(); + + private Map fooMap = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1 other) { + foo(other.getFoo()); + bar(other.getBar()); + fooMap(other.getFooMap()); + fooList(other.getFooList()); + fooSet(other.getFooSet()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull Bar bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFooSet(Set fooSet) { + this.fooSet.addAll(fooSet); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFooSet(FooSetItem fooSet) { + this.fooSet.add(fooSet); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fooSet", nulls = Nulls.SKIP) + public _FinalStage fooSet(Set fooSet) { + this.fooSet.clear(); + this.fooSet.addAll(fooSet); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFooList(List fooList) { + this.fooList.addAll(fooList); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFooList(FooListItem fooList) { + this.fooList.add(fooList); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fooList", nulls = Nulls.SKIP) + public _FinalStage fooList(List fooList) { + this.fooList.clear(); + this.fooList.addAll(fooList); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fooMap(String key, FooMapValue value) { + this.fooMap.put(key, value); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllFooMap(Map fooMap) { + this.fooMap.putAll(fooMap); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fooMap", nulls = Nulls.SKIP) + public _FinalStage fooMap(Map fooMap) { + this.fooMap.clear(); + this.fooMap.putAll(fooMap); + return this; + } + + @java.lang.Override + public RootType1 build() { + return new RootType1(foo, bar, fooMap, fooList, fooSet, ref, additionalProperties); + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = FooListItem.Builder.class) + public static final class FooListItem { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private FooListItem(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FooListItem && equalTo((FooListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FooListItem other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(FooListItem other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + FooListItem build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FooListItem other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public FooListItem build() { + return new FooListItem(foo, ref, additionalProperties); + } + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = FooSetItem.Builder.class) + public static final class FooSetItem { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private FooSetItem(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FooSetItem && equalTo((FooSetItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FooSetItem other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(FooSetItem other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + FooSetItem build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FooSetItem other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public FooSetItem build() { + return new FooSetItem(foo, ref, additionalProperties); + } + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = Bar.Builder.class) + public static final class Bar { + private final String foo; + + private final Bar bar; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private Bar(String foo, Bar bar, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public Bar getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1.Bar && equalTo((RootType1.Bar) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1.Bar other) { + return foo.equals(other.foo) && bar.equals(other.bar) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(RootType1.Bar other); + } + + public interface BarStage { + RefStage bar(@NotNull Bar bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1.Bar build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private Bar bar; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1.Bar other) { + foo(other.getFoo()); + bar(other.getBar()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull Bar bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public RootType1.Bar build() { + return new RootType1.Bar(foo, bar, ref, additionalProperties); + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = Bar.Builder.class) + public static final class Bar { + private final String foo; + + private final String bar; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private Bar(String foo, String bar, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public String getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Bar && equalTo((Bar) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Bar other) { + return foo.equals(other.foo) && bar.equals(other.bar) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(Bar other); + } + + public interface BarStage { + RefStage bar(@NotNull String bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + Bar build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private String bar; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Bar other) { + foo(other.getFoo()); + bar(other.getBar()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull String bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public Bar build() { + return new Bar(foo, bar, ref, additionalProperties); + } + } + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = FooMapValue.Builder.class) + public static final class FooMapValue { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private FooMapValue(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FooMapValue && equalTo((FooMapValue) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FooMapValue other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(FooMapValue other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + FooMapValue build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FooMapValue other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public FooMapValue build() { + return new FooMapValue(foo, ref, additionalProperties); + } + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooListItem.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooListItem.java new file mode 100644 index 00000000000..dca97759562 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooListItem.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RootType1FooListItem.Builder.class) +public final class RootType1FooListItem { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private RootType1FooListItem(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1FooListItem && equalTo((RootType1FooListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1FooListItem other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(RootType1FooListItem other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1FooListItem build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1FooListItem other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public RootType1FooListItem build() { + return new RootType1FooListItem(foo, ref, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooMapValue.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooMapValue.java new file mode 100644 index 00000000000..28e975f8d87 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooMapValue.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RootType1FooMapValue.Builder.class) +public final class RootType1FooMapValue { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private RootType1FooMapValue(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1FooMapValue && equalTo((RootType1FooMapValue) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1FooMapValue other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(RootType1FooMapValue other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1FooMapValue build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1FooMapValue other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public RootType1FooMapValue build() { + return new RootType1FooMapValue(foo, ref, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooSetItem.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooSetItem.java new file mode 100644 index 00000000000..272bcaec488 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1FooSetItem.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RootType1FooSetItem.Builder.class) +public final class RootType1FooSetItem { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private RootType1FooSetItem(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1FooSetItem && equalTo((RootType1FooSetItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1FooSetItem other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(RootType1FooSetItem other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1FooSetItem build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1FooSetItem other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public RootType1FooSetItem build() { + return new RootType1FooSetItem(foo, ref, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1.java new file mode 100644 index 00000000000..1359d030593 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1.java @@ -0,0 +1,317 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RootType1InlineType1.Builder.class) +public final class RootType1InlineType1 { + private final String foo; + + private final Bar bar; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private RootType1InlineType1(String foo, Bar bar, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public Bar getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1InlineType1 && equalTo((RootType1InlineType1) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1InlineType1 other) { + return foo.equals(other.foo) && bar.equals(other.bar) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(RootType1InlineType1 other); + } + + public interface BarStage { + RefStage bar(@NotNull Bar bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1InlineType1 build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private Bar bar; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1InlineType1 other) { + foo(other.getFoo()); + bar(other.getBar()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull Bar bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public RootType1InlineType1 build() { + return new RootType1InlineType1(foo, bar, ref, additionalProperties); + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = Bar.Builder.class) + public static final class Bar { + private final String foo; + + private final String bar; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private Bar(String foo, String bar, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public String getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Bar && equalTo((Bar) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Bar other) { + return foo.equals(other.foo) && bar.equals(other.bar) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(Bar other); + } + + public interface BarStage { + RefStage bar(@NotNull String bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + Bar build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private String bar; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Bar other) { + foo(other.getFoo()); + bar(other.getBar()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull String bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public Bar build() { + return new Bar(foo, bar, ref, additionalProperties); + } + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1NestedInlineType1.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1NestedInlineType1.java new file mode 100644 index 00000000000..5bf6e9e8111 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType1InlineType1NestedInlineType1.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RootType1InlineType1NestedInlineType1.Builder.class) +public final class RootType1InlineType1NestedInlineType1 { + private final String foo; + + private final String bar; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private RootType1InlineType1NestedInlineType1( + String foo, String bar, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public String getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1InlineType1NestedInlineType1 + && equalTo((RootType1InlineType1NestedInlineType1) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1InlineType1NestedInlineType1 other) { + return foo.equals(other.foo) && bar.equals(other.bar) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(RootType1InlineType1NestedInlineType1 other); + } + + public interface BarStage { + RefStage bar(@NotNull String bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1InlineType1NestedInlineType1 build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private String bar; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1InlineType1NestedInlineType1 other) { + foo(other.getFoo()); + bar(other.getBar()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull String bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public RootType1InlineType1NestedInlineType1 build() { + return new RootType1InlineType1NestedInlineType1(foo, bar, ref, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType2.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType2.java new file mode 100644 index 00000000000..4f166f05f49 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/RootType2.java @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RootType2 { + private final RootType1 value; + + private RootType2(RootType1 value) { + this.value = value; + } + + @JsonValue + public RootType1 get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof RootType2 && this.value.equals(((RootType2) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RootType2 of(RootType1 value) { + return new RootType2(value); + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/TestType.java b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/TestType.java new file mode 100644 index 00000000000..64fd30f6a6d --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/main/java/com/seed/object/types/TestType.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TestType.Builder.class) +public final class TestType { + private final RootType2 testProperty; + + private final Map additionalProperties; + + private TestType(RootType2 testProperty, Map additionalProperties) { + this.testProperty = testProperty; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("testProperty") + public RootType2 getTestProperty() { + return testProperty; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TestType && equalTo((TestType) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TestType other) { + return testProperty.equals(other.testProperty); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.testProperty); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TestPropertyStage builder() { + return new Builder(); + } + + public interface TestPropertyStage { + _FinalStage testProperty(@NotNull RootType2 testProperty); + + Builder from(TestType other); + } + + public interface _FinalStage { + TestType build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TestPropertyStage, _FinalStage { + private RootType2 testProperty; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TestType other) { + testProperty(other.getTestProperty()); + return this; + } + + @java.lang.Override + @JsonSetter("testProperty") + public _FinalStage testProperty(@NotNull RootType2 testProperty) { + this.testProperty = Objects.requireNonNull(testProperty, "testProperty must not be null"); + return this; + } + + @java.lang.Override + public TestType build() { + return new TestType(testProperty, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-inline/src/test/java/com/seed/object/TestClient.java b/seed/java-sdk/java-inline-types/no-inline/src/test/java/com/seed/object/TestClient.java new file mode 100644 index 00000000000..37f1534fe0c --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-inline/src/test/java/com/seed/object/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/.github/workflows/ci.yml b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.github/workflows/ci.yml new file mode 100644 index 00000000000..9910fd269c2 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: ci + +on: [push] + +jobs: + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Compile + run: ./gradlew compileJava + + test: + needs: [ compile ] + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Test + run: ./gradlew test + publish: + needs: [ compile, test ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Publish to maven + run: | + ./gradlew publish + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_PUBLISH_REGISTRY_URL: "" diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/.gitignore b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.gitignore new file mode 100644 index 00000000000..d4199abc2cd --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.gitignore @@ -0,0 +1,24 @@ +*.class +.project +.gradle +? +.classpath +.checkstyle +.settings +.node +build + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ +out/ + +# Eclipse/IntelliJ APT +generated_src/ +generated_testSrc/ +generated/ + +bin +build \ No newline at end of file diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/__package__.yml b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/__package__.yml new file mode 100644 index 00000000000..0151adee51a --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/__package__.yml @@ -0,0 +1,107 @@ +types: + # this is also the type that would be produced by + AliasMapInline: map + AliasSetInline: set + AliasListInline: list + + AliasInlineValue: + inline: true + properties: + foo: string + bar: string + + RootType2: RootType1 + + TestType: + properties: + testProperty: RootType2 + + RootType1: + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + bar: + type: RootType1InlineType1 + docs: lorem ipsum + fooMap: + type: map + docs: lorem ipsum + fooList: + type: list + docs: lorem ipsum + fooSet: + type: set + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1FooMapValue: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1FooListItem: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1FooSetItem: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1InlineType1: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + bar: + type: RootType1InlineType1NestedInlineType1 + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + RootType1InlineType1NestedInlineType1: + inline: true + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum + bar: + type: string + docs: lorem ipsum + ref: + type: ReferenceType + docs: lorem ipsum + + ReferenceType: + docs: lorem ipsum + properties: + foo: + type: string + docs: lorem ipsum diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/api.yml b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/api.yml new file mode 100644 index 00000000000..a82930c145b --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/definition/api.yml @@ -0,0 +1 @@ +name: object diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/fern.config.json b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/fern.config.json new file mode 100644 index 00000000000..4c8e54ac313 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "*"} \ No newline at end of file diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/generators.yml b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/generators.yml new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/.mock/generators.yml @@ -0,0 +1 @@ +{} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/build.gradle b/seed/java-sdk/java-inline-types/no-wrapped-aliases/build.gradle new file mode 100644 index 00000000000..12b766eeed2 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/build.gradle @@ -0,0 +1,101 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + api 'com.squareup.okhttp3:okhttp:4.12.0' + api 'com.fasterxml.jackson.core:jackson-databind:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +tasks.withType(Javadoc) { + failOnError false + options.addStringOption('Xdoclint:none', '-quiet') +} + +spotless { + java { + palantirJavaFormat() + } +} + + +java { + withSourcesJar() + withJavadocJar() +} + + +group = 'com.fern' + +version = '0.0.1' + +jar { + dependsOn(":generatePomFileForMavenPublication") + archiveBaseName = "java-inline-types" +} + +sourcesJar { + archiveBaseName = "java-inline-types" +} + +javadocJar { + archiveBaseName = "java-inline-types" +} + +test { + useJUnitPlatform() + testLogging { + showStandardStreams = true + } +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'com.fern' + artifactId = 'java-inline-types' + version = '0.0.1' + from components.java + pom { + licenses { + license { + name = 'The MIT License (MIT)' + url = 'https://mit-license.org/' + } + } + scm { + connection = 'scm:git:git://github.com/java-inline-types/fern.git' + developerConnection = 'scm:git:git://github.com/java-inline-types/fern.git' + url = 'https://github.com/java-inline-types/fern' + } + } + } + } + repositories { + maven { + url "$System.env.MAVEN_PUBLISH_REGISTRY_URL" + credentials { + username "$System.env.MAVEN_USERNAME" + password "$System.env.MAVEN_PASSWORD" + } + } + } +} + diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/build.gradle b/seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/build.gradle new file mode 100644 index 00000000000..4ee8f227b7a --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + implementation rootProject +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/src/main/java/sample/App.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/src/main/java/sample/App.java new file mode 100644 index 00000000000..b115384f1d2 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/sample-app/src/main/java/sample/App.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +package sample; + +import java.lang.String; + +public final class App { + public static void main(String[] args) { + // import com.seed.object.SeedObjectClient + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/settings.gradle b/seed/java-sdk/java-inline-types/no-wrapped-aliases/settings.gradle new file mode 100644 index 00000000000..8526e13fb82 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'java-inline-types' + +include 'sample-app' \ No newline at end of file diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/snippet-templates.json b/seed/java-sdk/java-inline-types/no-wrapped-aliases/snippet-templates.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/snippet.json b/seed/java-sdk/java-inline-types/no-wrapped-aliases/snippet.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClient.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClient.java new file mode 100644 index 00000000000..2cf6b8d40e5 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClient.java @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object; + +import com.seed.object.core.ClientOptions; + +public class SeedObjectClient { + protected final ClientOptions clientOptions; + + public SeedObjectClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public static SeedObjectClientBuilder builder() { + return new SeedObjectClientBuilder(); + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClientBuilder.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClientBuilder.java new file mode 100644 index 00000000000..49263572b1a --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/SeedObjectClientBuilder.java @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object; + +import com.seed.object.core.ClientOptions; +import com.seed.object.core.Environment; + +public final class SeedObjectClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private Environment environment; + + public SeedObjectClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client + */ + public SeedObjectClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + public SeedObjectClient build() { + clientOptionsBuilder.environment(this.environment); + return new SeedObjectClient(clientOptionsBuilder.build()); + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ClientOptions.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ClientOptions.java new file mode 100644 index 00000000000..63e04e1a6ba --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ClientOptions.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int timeout = 60; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = timeout; + return this; + } + + public ClientOptions build() { + OkHttpClient okhttpClient = new OkHttpClient.Builder() + .addInterceptor(new RetryInterceptor(3)) + .callTimeout(this.timeout, TimeUnit.SECONDS) + .build(); + return new ClientOptions(environment, headers, headerSuppliers, okhttpClient, this.timeout); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/DateTimeDeserializer.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/DateTimeDeserializer.java new file mode 100644 index 00000000000..ad231070a3d --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Environment.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Environment.java new file mode 100644 index 00000000000..19b694c5b93 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Environment.java @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +public final class Environment { + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/FileStream.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/FileStream.java new file mode 100644 index 00000000000..eef28eef8bd --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/InputStreamRequestBody.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/InputStreamRequestBody.java new file mode 100644 index 00000000000..433d823fbed --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/MediaTypes.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/MediaTypes.java new file mode 100644 index 00000000000..df45659067e --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ObjectMappers.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ObjectMappers.java new file mode 100644 index 00000000000..c889a5b4c3d --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RequestOptions.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RequestOptions.java new file mode 100644 index 00000000000..5ea45c533b5 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RequestOptions.java @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + +public final class RequestOptions { + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private RequestOptions(Optional timeout, TimeUnit timeoutTimeUnit) { + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public RequestOptions build() { + return new RequestOptions(timeout, timeoutTimeUnit); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyInputStream.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyInputStream.java new file mode 100644 index 00000000000..ea75c68fd88 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyReader.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyReader.java new file mode 100644 index 00000000000..3903eb7436c --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RetryInterceptor.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RetryInterceptor.java new file mode 100644 index 00000000000..9f541cea8fc --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 409 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectApiException.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectApiException.java new file mode 100644 index 00000000000..64ec8313ea1 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectApiException.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class SeedObjectApiException extends SeedObjectException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public SeedObjectApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + @java.lang.Override + public String toString() { + return "SeedObjectApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + body + "}"; + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectException.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectException.java new file mode 100644 index 00000000000..a338879cb59 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/SeedObjectException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class SeedObjectException extends RuntimeException { + public SeedObjectException(String message) { + super(message); + } + + public SeedObjectException(String message, Exception e) { + super(message, e); + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Stream.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Stream.java new file mode 100644 index 00000000000..ecc1492c728 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Stream.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implmenets {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable { + /** + * The {@link Class} of the objects in the stream. + */ + private final Class valueType; + /** + * The {@link Scanner} used for reading from the input stream and blocking when neede during iteration. + */ + private final Scanner scanner; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.valueType = valueType; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + return new Iterator() { + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + /** + * Removing elements from {@code Stream} is not supported. + * + * @throws UnsupportedOperationException Always, as removal is not supported. + */ + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Suppliers.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Suppliers.java new file mode 100644 index 00000000000..5001ddf4767 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/ReferenceType.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/ReferenceType.java new file mode 100644 index 00000000000..f420a13f682 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/ReferenceType.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReferenceType.Builder.class) +public final class ReferenceType { + private final String foo; + + private final Map additionalProperties; + + private ReferenceType(String foo, Map additionalProperties) { + this.foo = foo; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferenceType && equalTo((ReferenceType) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReferenceType other) { + return foo.equals(other.foo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + _FinalStage foo(@NotNull String foo); + + Builder from(ReferenceType other); + } + + public interface _FinalStage { + ReferenceType build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, _FinalStage { + private String foo; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReferenceType other) { + foo(other.getFoo()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public _FinalStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + @java.lang.Override + public ReferenceType build() { + return new ReferenceType(foo, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/RootType1.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/RootType1.java new file mode 100644 index 00000000000..3d90028eda5 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/RootType1.java @@ -0,0 +1,992 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RootType1.Builder.class) +public final class RootType1 { + private final String foo; + + private final Bar bar; + + private final Map fooMap; + + private final List fooList; + + private final Set fooSet; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private RootType1( + String foo, + Bar bar, + Map fooMap, + List fooList, + Set fooSet, + ReferenceType ref, + Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.fooMap = fooMap; + this.fooList = fooList; + this.fooSet = fooSet; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public Bar getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("fooMap") + public Map getFooMap() { + return fooMap; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("fooList") + public List getFooList() { + return fooList; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("fooSet") + public Set getFooSet() { + return fooSet; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1 && equalTo((RootType1) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1 other) { + return foo.equals(other.foo) + && bar.equals(other.bar) + && fooMap.equals(other.fooMap) + && fooList.equals(other.fooList) + && fooSet.equals(other.fooSet) + && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.fooMap, this.fooList, this.fooSet, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(RootType1 other); + } + + public interface BarStage { + RefStage bar(@NotNull Bar bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1 build(); + + _FinalStage fooMap(Map fooMap); + + _FinalStage putAllFooMap(Map fooMap); + + _FinalStage fooMap(String key, FooMapValue value); + + _FinalStage fooList(List fooList); + + _FinalStage addFooList(FooListItem fooList); + + _FinalStage addAllFooList(List fooList); + + _FinalStage fooSet(Set fooSet); + + _FinalStage addFooSet(FooSetItem fooSet); + + _FinalStage addAllFooSet(Set fooSet); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private Bar bar; + + private ReferenceType ref; + + private Set fooSet = new LinkedHashSet<>(); + + private List fooList = new ArrayList<>(); + + private Map fooMap = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1 other) { + foo(other.getFoo()); + bar(other.getBar()); + fooMap(other.getFooMap()); + fooList(other.getFooList()); + fooSet(other.getFooSet()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull Bar bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFooSet(Set fooSet) { + this.fooSet.addAll(fooSet); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFooSet(FooSetItem fooSet) { + this.fooSet.add(fooSet); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fooSet", nulls = Nulls.SKIP) + public _FinalStage fooSet(Set fooSet) { + this.fooSet.clear(); + this.fooSet.addAll(fooSet); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFooList(List fooList) { + this.fooList.addAll(fooList); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFooList(FooListItem fooList) { + this.fooList.add(fooList); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fooList", nulls = Nulls.SKIP) + public _FinalStage fooList(List fooList) { + this.fooList.clear(); + this.fooList.addAll(fooList); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fooMap(String key, FooMapValue value) { + this.fooMap.put(key, value); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllFooMap(Map fooMap) { + this.fooMap.putAll(fooMap); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fooMap", nulls = Nulls.SKIP) + public _FinalStage fooMap(Map fooMap) { + this.fooMap.clear(); + this.fooMap.putAll(fooMap); + return this; + } + + @java.lang.Override + public RootType1 build() { + return new RootType1(foo, bar, fooMap, fooList, fooSet, ref, additionalProperties); + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = FooListItem.Builder.class) + public static final class FooListItem { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private FooListItem(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FooListItem && equalTo((FooListItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FooListItem other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(FooListItem other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + FooListItem build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FooListItem other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public FooListItem build() { + return new FooListItem(foo, ref, additionalProperties); + } + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = FooSetItem.Builder.class) + public static final class FooSetItem { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private FooSetItem(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FooSetItem && equalTo((FooSetItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FooSetItem other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(FooSetItem other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + FooSetItem build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FooSetItem other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public FooSetItem build() { + return new FooSetItem(foo, ref, additionalProperties); + } + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = Bar.Builder.class) + public static final class Bar { + private final String foo; + + private final Bar bar; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private Bar(String foo, Bar bar, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public Bar getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RootType1.Bar && equalTo((RootType1.Bar) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RootType1.Bar other) { + return foo.equals(other.foo) && bar.equals(other.bar) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(RootType1.Bar other); + } + + public interface BarStage { + RefStage bar(@NotNull Bar bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + RootType1.Bar build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private Bar bar; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RootType1.Bar other) { + foo(other.getFoo()); + bar(other.getBar()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull Bar bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public RootType1.Bar build() { + return new RootType1.Bar(foo, bar, ref, additionalProperties); + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = Bar.Builder.class) + public static final class Bar { + private final String foo; + + private final String bar; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private Bar(String foo, String bar, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.bar = bar; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("bar") + public String getBar() { + return bar; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Bar && equalTo((Bar) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Bar other) { + return foo.equals(other.foo) && bar.equals(other.bar) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.bar, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + BarStage foo(@NotNull String foo); + + Builder from(Bar other); + } + + public interface BarStage { + RefStage bar(@NotNull String bar); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + Bar build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, BarStage, RefStage, _FinalStage { + private String foo; + + private String bar; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Bar other) { + foo(other.getFoo()); + bar(other.getBar()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public BarStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bar") + public RefStage bar(@NotNull String bar) { + this.bar = Objects.requireNonNull(bar, "bar must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public Bar build() { + return new Bar(foo, bar, ref, additionalProperties); + } + } + } + } + + @JsonInclude(JsonInclude.Include.NON_ABSENT) + @JsonDeserialize(builder = FooMapValue.Builder.class) + public static final class FooMapValue { + private final String foo; + + private final ReferenceType ref; + + private final Map additionalProperties; + + private FooMapValue(String foo, ReferenceType ref, Map additionalProperties) { + this.foo = foo; + this.ref = ref; + this.additionalProperties = additionalProperties; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + /** + * @return lorem ipsum + */ + @JsonProperty("ref") + public ReferenceType getRef() { + return ref; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FooMapValue && equalTo((FooMapValue) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FooMapValue other) { + return foo.equals(other.foo) && ref.equals(other.ref); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.foo, this.ref); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FooStage builder() { + return new Builder(); + } + + public interface FooStage { + RefStage foo(@NotNull String foo); + + Builder from(FooMapValue other); + } + + public interface RefStage { + _FinalStage ref(@NotNull ReferenceType ref); + } + + public interface _FinalStage { + FooMapValue build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FooStage, RefStage, _FinalStage { + private String foo; + + private ReferenceType ref; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FooMapValue other) { + foo(other.getFoo()); + ref(other.getRef()); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("foo") + public RefStage foo(@NotNull String foo) { + this.foo = Objects.requireNonNull(foo, "foo must not be null"); + return this; + } + + /** + *

lorem ipsum

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ref") + public _FinalStage ref(@NotNull ReferenceType ref) { + this.ref = Objects.requireNonNull(ref, "ref must not be null"); + return this; + } + + @java.lang.Override + public FooMapValue build() { + return new FooMapValue(foo, ref, additionalProperties); + } + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/TestType.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/TestType.java new file mode 100644 index 00000000000..2a090081708 --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/main/java/com/seed/object/types/TestType.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.seed.object.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TestType.Builder.class) +public final class TestType { + private final RootType1 testProperty; + + private final Map additionalProperties; + + private TestType(RootType1 testProperty, Map additionalProperties) { + this.testProperty = testProperty; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("testProperty") + public RootType1 getTestProperty() { + return testProperty; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TestType && equalTo((TestType) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TestType other) { + return testProperty.equals(other.testProperty); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.testProperty); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TestPropertyStage builder() { + return new Builder(); + } + + public interface TestPropertyStage { + _FinalStage testProperty(@NotNull RootType1 testProperty); + + Builder from(TestType other); + } + + public interface _FinalStage { + TestType build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TestPropertyStage, _FinalStage { + private RootType1 testProperty; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TestType other) { + testProperty(other.getTestProperty()); + return this; + } + + @java.lang.Override + @JsonSetter("testProperty") + public _FinalStage testProperty(@NotNull RootType1 testProperty) { + this.testProperty = Objects.requireNonNull(testProperty, "testProperty must not be null"); + return this; + } + + @java.lang.Override + public TestType build() { + return new TestType(testProperty, additionalProperties); + } + } +} diff --git a/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/test/java/com/seed/object/TestClient.java b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/test/java/com/seed/object/TestClient.java new file mode 100644 index 00000000000..37f1534fe0c --- /dev/null +++ b/seed/java-sdk/java-inline-types/no-wrapped-aliases/src/test/java/com/seed/object/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.seed.object; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +}